Skip to content

Latest commit

 

History

History
38 lines (23 loc) · 1.38 KB

iii.3.56-rem-un.md

File metadata and controls

38 lines (23 loc) · 1.38 KB

III.3.56 rem.un – compute integer remainder, unsigned

Format Assembly Format Description
5E rem.un Remainder when dividing one unsigned value by another.

Stack Transition:

…, value1, value2 → …, result

Description:

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 = value1value2 × (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.

Exceptions:

Integral operations throw System.DivideByZeroException if value2 is zero.

Example:

   
+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)

Correctness and Verifiability:

See Table 5: Integer Operations.