Arithmetic operators



      ckfinite      fadd      fdiv      fmul
      fneg      frem      fsub      iadd
      iadd_ovf      iadd_ovf_un      idiv      idiv_un
      imul      imul_ovf      imul_ovf_un      ineg
      irem      irem_un      isub      isub_ovf
      isub_ovf_un      ladd      ladd_ovf      ladd_ovf_un
      ldiv      ldiv_un      lmul      lmul_ovf
      lmul_ovf_un      lneg      lrem      lrem_un
      lsub      lsub_ovf      lsub_ovf_un 


 ckfinite 
  ·  OperationCheck native float for finite
  ·  Format
prefix
ckfinite
  ·  Direct Format
{ckfinite}
  ·  Forms ckfinite = 255, 62 (0xFF, 0x3E)
  ·  Stack..., value => ...
   · Description The value is popped from the stack as type native float. If value is not finite (i.e. it is NaN, positive infinity, or negative infinity), then System.ArithmeticException is thrown.
   · Exceptions System.ArithmeticException -- Raised if value is not finite.


 fadd 
  ·  OperationAdd native float
  ·  Format
fadd
  ·  Direct Format
{fadd}
  ·  Forms fadd = 95 (0x5F)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type native float. The native float result is value1 + value2. The result is pushed onto the stack.
   · Notes Values of type native float typically occupy multiple stack slots. The exact number of slots is machine-dependent, as is the precision of the native float type.

When we say that value1 and value2 are popped, we assume that the correct number of stack slots for the machine are popped. Similarly when result is pushed.

To perform strict 32-bit floating point addition, use fadd followed by f2f. To perform strict 64-bit floating point addition, use fadd followed by f2d.



 fdiv 
  ·  OperationDivide native float
  ·  Format
fdiv
  ·  Direct Format
{fdiv}
  ·  Forms fdiv = 98 (0x62)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type native float. The native float result is value1 / value2. The result is pushed onto the stack.


 fmul 
  ·  OperationMultiply native float
  ·  Format
fmul
  ·  Direct Format
{fmul}
  ·  Forms fmul = 97 (0x61)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type native float. The native float result is value1 * value2. The result is pushed onto the stack.


 fneg 
  ·  OperationNegate native float
  ·  Format
fneg
  ·  Direct Format
{fneg}
  ·  Forms fneg = 100 (0x64)
  ·  Stack..., value => ..., result
   · Description The value is popped from the stack as type native float. The native float result is -value. The result is pushed onto the stack.


 frem 
  ·  OperationRemainder native float
  ·  Format
frem
  ·  Direct Format
{frem}
  ·  Forms frem = 99 (0x63)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type native float. The native float result is value1 % value2. The result is pushed onto the stack.
   · Notes The remainder operation is similar to the C fmod function, not IEEE remainder.


 fsub 
  ·  OperationSubtract native float
  ·  Format
fsub
  ·  Direct Format
{fsub}
  ·  Forms fsub = 96 (0x60)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped fr om the stack as type native float. The native float result is value1 - value2. The result is pushed onto the stack.


 iadd 
  ·  OperationAdd int32
  ·  Format
iadd
  ·  Direct Format
{iadd}
  ·  Forms iadd = 67 (0x43)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int32. The int32 result is value1 + value2. The result is pushed onto the stack.

The result is the 32 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int32. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical sum of the two values.

   · Notes The iadd instruction can also be used to add values of type uint32.


 iadd_ovf 
  ·  OperationAdd int32 with overflow detection
  ·  Format
iadd_ovf
  ·  Direct Format
{iadd_ovf}
  ·  Forms iadd_ovf = 68 (0x44)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int32. The int32 result is value1 + value2. The result is pushed onto the stack.

The result is the 32 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int32. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type int32.


 iadd_ovf_un 
  ·  OperationAdd uint32 with overflow detection
  ·  Format
iadd_ovf_un
  ·  Direct Format
{iadd_ovf_un}
  ·  Forms iadd_ovf_un = 69 (0x45)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint32. The uint32 result is value1 + value2. The result is pushed onto the stack.

The result is the 32 low-order bits of the true mathematical result in a sufficiently wide unsigned format, represented as a value of type uint32. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type uint32.


 idiv 
  ·  OperationDivide int32
  ·  Format
idiv
  ·  Direct Format
{idiv}
  ·  Forms idiv = 76 (0x4C)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int32. The int32 result is value1 / value2. The result is pushed onto the stack.
   · Exceptions System.DivideByZeroException -- Raised if value2 is zero.
System.ArithmeticException -- Raised if value1 is -1 and value2 is -2147483648.


 idiv_un 
  ·  OperationDivide uint32
  ·  Format
idiv_un
  ·  Direct Format
{idiv_un}
  ·  Forms idiv_un = 77 (0x4D)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint32. The uint32 result is value1 / value2. The result is pushed onto the stack.
   · Exceptions System.DivideByZeroException -- Raised if value2 is zero.


 imul 
  ·  OperationMultiply int32
  ·  Format
imul
  ·  Direct Format
{imul}
  ·  Forms imul = 73 (0x49)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int32. The int32 result is value1 * value2. The result is pushed onto the stack.

The result is the 32 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int32. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical multiplication of the two values.

   · Notes The imul instruction can also be used to multiply values of type uint32.


 imul_ovf 
  ·  OperationMultiply int32 with overflow detection
  ·  Format
imul_ovf
  ·  Direct Format
{imul_ovf}
  ·  Forms imul_ovf = 74 (0x4A)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int32. The int32 result is value1 * value2. The result is pushed onto the stack.

The result is the 32 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int32. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type int32.


 imul_ovf_un 
  ·  OperationMultiply uint32 with overflow detection
  ·  Format
imul_ovf_un
  ·  Direct Format
{imul_ovf_un}
  ·  Forms imul_ovf_un = 75 (0x4B)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint32. The uint32 result is value1 * value2. The result is pushed onto the stack.

The result is the 32 low-order bits of the true mathematical result in a sufficiently wide unsigned format, represented as a value of type uint32. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type uint32.


 ineg 
  ·  OperationNegate int32
  ·  Format
ineg
  ·  Direct Format
{ineg}
  ·  Forms ineg = 80 (0x50)
  ·  Stack..., value => ..., result
   · Description The value is popped from the stack as type int32. The int32 result is -value. The result is pushed onto the stack.
   · Notes To perform negation with overflow detection, use isub_ovf with the first argument set to 0 and the second argument set to value.


 irem 
  ·  OperationRemainder int32
  ·  Format
irem
  ·  Direct Format
{irem}
  ·  Forms irem = 78 (0x4E)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int32. The int32 result is value1 % value2. The result is pushed onto the stack.
   · Exceptions System.DivideByZeroException -- Raised if value2 is zero.
System.ArithmeticException -- Raised if value1 is -1 and value2 is -2147483648.


 irem_un 
  ·  OperationRemainder uint32
  ·  Format
irem_un
  ·  Direct Format
{irem_un}
  ·  Forms irem_un = 79 (0x4F)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint32. The uint32 result is value1 % value2. The result is pushed onto the stack.
   · Exceptions System.DivideByZeroException -- Raised if value2 is zero.


 isub 
  ·  OperationSubtract int32
  ·  Format
isub
  ·  Direct Format
{isub}
  ·  Forms isub = 70 (0x46)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int32. The int32 result is value1 - value2. The result is pushed onto the stack.

The result is the 32 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int32. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical difference of the two values.

   · Notes The isub instruction can also be used to subtract values of type uint32.


 isub_ovf 
  ·  OperationSubtract int32 with overflow detection
  ·  Format
isub_ovf
  ·  Direct Format
{isub_ovf}
  ·  Forms isub_ovf = 71 (0x47)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int32. The int32 result is value1 - value2. The result is pushed onto the stack.

The result is the 32 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int32. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type int32.


 isub_ovf_un 
  ·  OperationSubtract uint32 with overflow detection
  ·  Format
isub_ovf_un
  ·  Direct Format
{isub_ovf_un}
  ·  Forms isub_ovf_un = 72 (0x48)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint32. The uint32 result is value1 - value2. The result is pushed onto the stack.

The result is the 32 low-order bits of the true mathematical result in a sufficiently wide unsigned format, represented as a value of type uint32. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type uint32.


 ladd 
  ·  OperationAdd int64
  ·  Format
ladd
  ·  Direct Format
{ladd}
  ·  Forms ladd = 81 (0x51)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int64. The int64 result is value1 + value2. The result is pushed onto the stack.

The result is the 64 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int64. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical sum of the two values.

   · Notes The ladd instruction can also be used to add values of type uint64.

Values of type int64 typically occupy 2 stack slots on 32-bit machines and 1 stack slot on 64-bit machines, although this is layout not fixed. When we say that value1 and value2 are popped, we assume that the correct number of stack slots for the machine are popped. Similarly when result is pushed.



 ladd_ovf 
  ·  OperationAdd int64 with overflow detection
  ·  Format
ladd_ovf
  ·  Direct Format
{ladd_ovf}
  ·  Forms ladd_ovf = 82 (0x52)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int64. The int64 result is value1 + value2. The result is pushed onto the stack.

The result is the 64 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int64. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type int64.


 ladd_ovf_un 
  ·  OperationAdd uint64 with overflow detection
  ·  Format
ladd_ovf_un
  ·  Direct Format
{ladd_ovf_un}
  ·  Forms ladd_ovf_un = 83 (0x53)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint64. The uint64 result is value1 + value2. The result is pushed onto the stack.

The result is the 64 low-order bits of the true mathematical result in a sufficiently wide unsignedcomplement format, represented as a value of type uint64. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type uint64.


 ldiv 
  ·  OperationDivide int64
  ·  Format
ldiv
  ·  Direct Format
{ldiv}
  ·  Forms ldiv = 90 (0x5A)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int64. The int64 result is value1 / value2. The result is pushed onto the stack.
   · Exceptions System.DivideByZeroException -- Raised if value2 is zero.
System.ArithmeticException -- Raised if value1 is -1 and value2 is -9223372036854775808.


 ldiv_un 
  ·  OperationDivide uint64
  ·  Format
ldiv_un
  ·  Direct Format
{ldiv_un}
  ·  Forms ldiv_un = 91 (0x5B)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint64. The uint64 result is value1 / value2. The result is pushed onto the stack.
   · Exceptions System.DivideByZeroException -- Raised if value2 is zero.


 lmul 
  ·  OperationMultiply int64
  ·  Format
lmul
  ·  Direct Format
{lmul}
  ·  Forms lmul = 87 (0x57)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int64. The int64 result is value1 * value2. The result is pushed onto the stack.

The result is the 64 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int64. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical multiplication of the two values.

   · Notes The lmul instruction can also be used to multiply values of type uint64.


 lmul_ovf 
  ·  OperationMultiply int64 with overflow detection
  ·  Format
lmul_ovf
  ·  Direct Format
{lmul_ovf}
  ·  Forms lmul_ovf = 88 (0x58)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int64. The int64 result is value1 * value2. The result is pushed onto the stack.

The result is the 64 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int64. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type int64.


 lmul_ovf_un 
  ·  OperationMultiply uint64 with overflow detection
  ·  Format
lmul_ovf_un
  ·  Direct Format
{lmul_ovf_un}
  ·  Forms lmul_ovf_un = 89 (0x59)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint64. The uint64 result is value1 * value2. The result is pushed onto the stack.

The result is the 64 low-order bits of the true mathematical result in a sufficiently wide unsignedcomplement format, represented as a value of type uint64. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type uint64.


 lneg 
  ·  OperationNegate int64
  ·  Format
lneg
  ·  Direct Format
{lneg}
  ·  Forms lneg = 94 (0x5E)
  ·  Stack..., value => ..., result
   · Description The value is popped from the stack as type int64. The int64 result is -value. The result is pushed onto the stack.
   · Notes To perform negation with overflow detection, use lsub_ovf with the first argument set to 0 and the second argument set to value.


 lrem 
  ·  OperationRemainder int64
  ·  Format
lrem
  ·  Direct Format
{lrem}
  ·  Forms lrem = 92 (0x5C)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int64. The int64 result is value1 % value2. The result is pushed onto the stack.
   · Exceptions System.DivideByZeroException -- Raised if value2 is zero.
System.ArithmeticException -- Raised if value1 is -1 and value2 is -9223372036854775808.


 lrem_un 
  ·  OperationRemainder uint64
  ·  Format
lrem_un
  ·  Direct Format
{lrem_un}
  ·  Forms lrem_un = 93 (0x5D)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint64. The uint64 result is value1 % value2. The result is pushed onto the stack.
   · Exceptions System.DivideByZeroException -- Raised if value2 is zero.


 lsub 
  ·  OperationSubtract int64
  ·  Format
lsub
  ·  Direct Format
{lsub}
  ·  Forms lsub = 84 (0x54)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int64. The int64 result is value1 - value2. The result is pushed onto the stack.

The result is the 64 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int64. If overflow occurs, then the sign of the result may not be the same as the sign of the mathematical difference of the two values.

   · Notes The lsub instruction can also be used to subtract values of type uint64.


 lsub_ovf 
  ·  OperationSubtract int64 with overflow detection
  ·  Format
lsub_ovf
  ·  Direct Format
{lsub_ovf}
  ·  Forms lsub_ovf = 85 (0x55)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type int64. The int64 result is value1 - value2. The result is pushed onto the stack.

The result is the 64 low-order bits of the true mathematical result in a sufficiently wide two's-complement format, represented as a value of type int64. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type int64.


 lsub_ovf_un 
  ·  OperationSubtract uint64 with overflow detection
  ·  Format
lsub_ovf_un
  ·  Direct Format
{lsub_ovf_un}
  ·  Forms lsub_ovf_un = 86 (0x56)
  ·  Stack..., value1, value2 => ..., result
   · Description Both value1 and value2 are popped from the stack as type uint64. The uint64 result is value1 - value2. The result is pushed onto the stack.

The result is the 64 low-order bits of the true mathematical result in a sufficiently wide unsignedcomplement format, represented as a value of type uint64. If overflow occurs, then System.OverflowException is thrown.

   · Exceptions System.OverflowException -- Raised if the true mathemetical result is too large to be represented as a value of type uint64.


Copyright © Southern Storm Software Pty Ltd 2002
Licensed under GNU FDL