sipush <n>
<n>
is a signed integer in the range -32768 to 32767.
Stack
Before
Description
After
...
value
...
sipush takes a single parameter, <n> (a 16-bit signed integer), sign extends it to a 32-bit int, and pushes the resulting int onto the operand stack.
sipush is typically more efficient than ldc. It also occupies fewer bytes in the class file.
Example
sipush 0x10 ; push the value 0x10 (16)
; onto the operand stack
Bytecode
The sipush opcode is followed in the bytecode by a 16-bit signed short specifying the integer value to push.
Type
|
Description
|
|
u1
|
sipush
opcode = 0x11 (17)
|
|
s2
|
<n>
|
bipush, ldc, ldc_w, ldc2_w, aconst_null, iconst_m1, iconst_<n>, lconst_<l>, fconst_<f>, dconst_<d>