prev next contents
lcmp

long integer comparison

Jasmin Syntax


    lcmp

Stack

Before

After
value1-word1
int-result
value1-word2
...
value2-word1

value2-word2

...

Description

Takes two two-word long integers off the stack and compares them. If the two integers are the same, the int 0 is pushed onto the stack. If value2 is greater than value1, the int 1 is pushed onto the stack. If value1 is greater than value2, the int -1 is pushed onto the 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
Bytecode

Type

Description
u1
lcmp opcode = 0x94 (148)
See Also

fcmpl, fcmpg, dcmpl, dcmpg


prev next contents
Java Virtual Machine, by Jon Meyer and Troy Downing, O'Reilly Associates