Arithmetic shift right int
Bytecode
Type | Description |
u1 | ishr opcode = 0x7A (122) |
Stack ..., value1, value2 => ..., result
Description
Pops two ints off the stack. Shifts value1 right by the amount
indicated in the five low bits of value2. The int result is then pushed back onto
the stack. value1 is shifted arithmetically (preserving the sign extension).
Both value1 and value2 must be of type int
. The values are
popped from the operand stack. An int
result is calculated by shifting
value1 right by s bit positions, with sign extension, where s is
the value of the low five bits of value2. The result is pushed onto the
operand stack.
This is the same as computing the expression:
x / 2s
where s is value1 and x is value2.
; This is like the Java code: ; int x; ; x >>= 3; ; iload_1 ; load local variable 1 onto stack iconst_3 ; push the integer 3 onto the stack ishr ; arithmetic shift right istore_1 ; store the result in local variable 1