Skip to content

Latest commit

 

History

History
46 lines (27 loc) · 1.2 KB

rem.md

File metadata and controls

46 lines (27 loc) · 1.2 KB

rem (remainder)

todo

$$ T.\mathsf{rem}_s \enspace ( a: T, b: T ) \to a\mod b $$

Instructions

Opcode Instruction Stack Arity
0x6F i32.rem_s $[ \mathsf{i32}, \mathsf{i32} ] \to [ \mathsf{i32} ]$
0x70 i32.rem_u $[ \mathsf{i32}, \mathsf{i32} ] \to [ \mathsf{i32} ]$
0x81 i64.rem_s $[ \mathsf{i64}, \mathsf{i64} ] \to [ \mathsf{i64} ]$
0x82 i64.rem_u $[ \mathsf{i64}, \mathsf{i64} ] \to [ \mathsf{i64} ]$

WAT Examples

Taking the remainder of dividing two constants

;; Places 2 values on the stack
i32.const 23
i32.const 10

;; Takes two values off of the stack (23 and 10), divides, and
;; places the remainder (3) on the stack
i32.rem_u

References

WebAssembly Core Specification