View Javadoc
1 package jrre.instructionset.comparison; 2 3 import jrre.Stack; 4 import jrre.types.PrimitiveType; 5 6 public class LCmp extends jrre.instructionset.Instruction { 7 8 public LCmp(){ 9 10 name = "lcmp"; 11 description = "foo foo moo poo"; 12 length = 0; 13 } 14 15 public void execute(){ 16 17 PrimitiveType twoHigh = (PrimitiveType)Stack.popOperand(); 18 PrimitiveType twoLow = (PrimitiveType)Stack.popOperand(); 19 20 PrimitiveType oneHigh = (PrimitiveType)Stack.popOperand(); 21 PrimitiveType oneLow = (PrimitiveType)Stack.popOperand(); 22 23 long valueOne = ((oneHigh.getValue() << 32) | oneLow.getValue()); 24 long valueTwo = ((twoHigh.getValue() << 32) | twoLow.getValue()); 25 26 if(valueOne == valueTwo) 27 Stack.pushOperand(new PrimitiveType(0)); 28 else if(valueOne > valueTwo) 29 Stack.pushOperand(new PrimitiveType(1)); 30 else 31 Stack.pushOperand(new PrimitiveType(-1)); 32 33 } 34 35 public String toString(){ 36 return "lcmp"; 37 } 38 }

This page was automatically generated by Maven