Format | Assembly Format | Description |
---|---|---|
5E | rem.un |
Remainder when dividing one unsigned value by another. |
…, value1, value2 → …, result
The rem.un
instruction divides value1 by value2 and pushes the remainder result on the stack. (rem.un
treats its arguments as unsigned integers, while rem
treats them as signed integers.)
result = value1 rem.un
value2 satisfies the following conditions:
-
result = value1 – value2 × (value1
div.un
value2), and -
0 ≤ result < value2,
where div.un
is the unsigned division instruction. rem.un
is unspecified for floating-point numbers. The acceptable operand types and their corresponding result data type are encapsulated in Table 5: Integer Operations.
Integral operations throw System.DivideByZeroException
if value2 is zero.
+5 rem.un +3 is 2 |
(+5 div.un +3 = 1) |
+5 rem.un -3 is 5 |
(+5 div.un -3 = 0) |
-5 rem.un +3 is 2 |
( -5 div.un +3 = 1431655763 or 0x55555553) |
-5 rem.un -3 is -5 or 0xfffffffb |
( -5 div.un -3 = 0) |