Site Tools


Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcvm:7.5.26_i2b

7.5.26 i2b

Convert int to byte

Format

i2b

Forms

i2b = 93 (0x5d)

Stack

…, value.word1, value.word2 → …, result

Description

The value on top of the operand stack must be of type int. It is popped from the operand stack and converted to a byte result by taking the low-order 16 bits of the int value, and discarding the high-order 16 bits. The low-order word is truncated to a byte, then sign-extended to a short result. The result is pushed onto the operand stack.

Notes

The i2b instruction performs a narrowing primitive conversion. It may lose information about the overall magnitude of value. The result may also not have the same sign as value.

If a virtual machine does not support the int data type, the i2b instruction will not be available.

javacard/jcvm/7.5.26_i2b.txt · Last modified: 2017/05/13 04:09 (external edit)