90.

prev next contents
idiv

divide an integer by another integer

Jasmin Syntax
     idiv 
Stack

Before

After
value1
result
value2
...
...

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)

Bytecode

Type

Description
u1
idiv opcode = 0x6C (108)
See Also

ldiv, fdiv, ddiv

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.


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


Java Virtual Machine
Java Virtual Machine (Java Series)
ISBN: 1565921941
EAN: 2147483647
Year: 1996
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net