Site Tools


Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcvm:7.5.52_ineg

7.5.52 ineg

Negate int

Format

ineg

Forms

ineg = 76 (0x4c)

Stack

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

Description

The value must be of type int. It is popped from the operand stack. The int result is the arithmetic negation of value, -value. The result is pushed onto the operand stack.

For int values, negation is the same as subtraction from zero. Because the Java Card virtual machine uses two's-complement representation for integers and the range of two's-complement values is not symmetric, the negation of the maximum negative int results in that same maximum negative number. Despite the fact that overflow has occurred, no exception is thrown.

For all int values x, -x equals (~x) + 1.

Notes

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

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