idiv :
divide an integer by another integer : index : visitInsn()
- Description
- Pops the top two integers from the operand stack and divides the
second-from top integer (value2) by the top integer (value1),
i.e. computes (value2 div value1). The quotient result is
truncated to the nearest integer (with rounding going towards zero, so 1.7
becomes 1) and placed on the stack.
- Exceptions
- ArithmeticException - attempt to divide by 0 (i.e. value1 is 0)
- Notes
- Because of the two's-complement representation used for negative
numbers, dividing Integer.MIN_VALUE by -1 produces Integer.MIN_VALUE, not
Integer.MAX_VALUE as you might expect.
- See also
- ldiv fdiv ddiv
- Stack
Before
|
After |
value1 |
result |
value2 |
... |
... |
... |
- Bytecode
Type
|
Description |
u1
|
idiv
opcode = 0x6C (108)
|