1 package jrre.instructionset.comparison;
2
3 import jrre.Stack;
4 import jrre.types.FloatType;
5 import jrre.types.PrimitiveType;
6
7 public class FCmpl extends jrre.instructionset.Instruction {
8
9 public FCmpl(){
10
11 name = "fcmpl";
12 description = "foo foo moo poo";
13 length = 0;
14 }
15
16 /***
17 * @task add NaN checking.
18 */
19 public void execute(){
20
21 FloatType floatTwo = (FloatType)Stack.popOperand();
22 FloatType floatOne = (FloatType)Stack.popOperand();
23
24 float valueOne = floatOne.getValue();
25 float valueTwo = floatTwo.getValue();
26
27 if(valueOne == valueTwo)
28 Stack.pushOperand(new PrimitiveType(0));
29 else if(valueOne > valueTwo)
30 Stack.pushOperand(new PrimitiveType(1));
31 else
32 Stack.pushOperand(new PrimitiveType(-1));
33
34 }
35
36 public String toString(){
37 return "fcmpl";
38 }
39 }
This page was automatically generated by Maven