prev next contents
ishr

integer arithmetic shift right

Jasmin Syntax


    ishr

Stack

Before

After
value1
result
value2
...
...

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).

This is the same as computing the expression:

x / 2s

where s is value1 and x is value2.

Example


; 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

Bytecode

Type

Description
u1
ishr opcode = 0x7A (122)
See Also

ishl, iushr, lshl, lshr, lushr, iand, land, ior, lor, ixor, lxor


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