Site Tools


Sidebar

Smart Card Solution

User Manual

JavaCard API Samples

Java Card Specification

Knowledge Sharing

javacard:jcvm:7.5.96_sneg

7.5.96 sneg

Negate short

Format

sneg

Forms

sneg = 72 (0x4b)

Stack

…, value → …, result

Description

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

For short 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 short results in that same maximum negative number. Despite the fact that overflow has occurred, no exception is thrown.

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

javacard/jcvm/7.5.96_sneg.txt · Last modified: 2017/05/13 04:10 (external edit)