i32.wrap_i64
Pops an i64 value off the stack, converts it into an i32 value, and then pushes it back on to the stack. Only the bottom 32 bits of the 64 bit number are used. Anything in the top 32 bits are lost.

Syntax

i32.wrap_i64

Stack In

i64 The value to be converted.

Stack Out

i32 The i32 version of the i64 value.

Examples

;; Convert i64 0x00000000_00000001 into an i32 value
i64.const 0x0000000000000001
i32.wrap_i64

;; The stack contains an i32 value of 0x00000001
;; Convert i64 0xFFFFFFFF_FFFFFFFF (-1) into an i32 value
i64.const 0xFFFFFFFFFFFFFFFF
i32.wrap_i64

;; The stack contains an i32 value of 0xFFFFFFFF (-1)
;; Convert i64 0x01234567_89ABCDEF into an i32 value
i64.const 0x0123456789ABCDEF
i32.wrap_i64

;; The stack contains an i32 value of 0x89ABCDEF