Compare long
Bytecode
Type | Description |
u1 | lcmp opcode = 0x94 (148) |
Stack ..., value1.word1, value1.word2, value2.word1, value2.word1 => ..., result
Description
Both value1 and value2 must be of type long
. They are both
popped from the operand stack, and a signed integer comparison is performed.
If value1 is greater than value2, the int
value 1 is pushed
onto the operand stack.
If value1 is equal to value2, the int
value 0 is pushed onto
the operand stack.
If value1 is less than value2, the int
value -1 is pushed
onto the operand stack.
Example
; This is like the Java expression: ; (x > 0) ; where x is a long. lload_1 ; push the long int in local variable 1 lconst_0 ; push the long integer 0 onto the stack lcmp ; compare the two long integers ; The integer result on the stack is: ; 0 if local variable 1 equals 0 ; -1 if local variable 1 is less than 0 ; 1 if local variable 1 is greater than 0