81.

prev next contents
i2b

convert integer to byte

Jasmin Syntax
     i2b 
Stack

Before

After
value
result
...
...
Description

Converts an integer to a signed byte. A 32-bit int is popped off the stack, the top 24 bits are discarded (they are set to zero), then the resulting value is signed extended to an int. The int result is pushed back onto the stack.

i2b is used in Java where there is a cast between an int and a byte. Notice that i2b can cause a change in sign. For example, in the code:

     int x = -134;     byte b = (byte)x; 
The value of b is positive 122 - the sign bit of x is lost in the conversion.

Bytecode

Type

Description
u1
i2b opcode = 0x91 (145)
See Also

i2c, i2s


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