i64.load16_u
Takes 16 bits (2 bytes) of memory from the given location and pushes it onto the stack as an i64 value. This looks at the value as an unsigned integer (positive value only). It does not check if the 16 bit value is negative but only copies the bits over, leaving the higher parts of the i64 value set to zero.

Syntax

i64.load16_u offset=n align=n

Parameters

offset Optional
A numeric value that gives an extra offset to the memory location given. Must be a positive value. Can be written as a decimal number or using the 0x00 hexadecimal notation. If the memory location is 8 and you add an extra offset of 2, then the final memory location is 10. This is useful if you are using a data structure with fields at different locations inside.
align Optional
Gives information to the machine running the application about the alignment that could be used when setting the location of the memory. This can only be 0, 1, 2, or 4. You will not see any difference and it may not even be used. It is more of a hint than a command.

Stack In

i32 Memory offset location to get the data from.

Stack Out

i64 The data copied from memory.

Examples

;; Memory is [ 0x81, 0x92, 0xA3, 0xB4, 0xC5, 0xD6, 0xE7, 0xF8 ]

;; Push the i32 memory offset value location onto the stack
i32.const 2

;; Pop the memory location off the stack, get the memory
;; at the given location, and push the value onto the stack
i64.load16_u

;; The stack contains an i64 value of 0xB4A3 = 0x000000000000B4A3
;; Memory is [ 0x81, 0x92, 0xA3, 0xB4, 0xC5, 0xD6, 0xE7, 0xF8 ]

;; Push the i32 memory offset value location onto the stack
i32.const 6

;; Pop the memory location off the stack, get the memory
;; at the given location, and push the value onto the stack
i64.load16_u

;; The stack contains an i64 value of 0xF8E7 = 0x000000000000F8E7
;; Memory is [ 0x81, 0x92, 0xA3, 0xB4, 0xC5, 0xD6, 0xE7, 0xF8 ]

;; Push the i32 memory offset value location onto the stack
i32.const 2

;; Pop the memory location off the stack, get the memory
;; at the given location, and push the value onto the stack
i64.load16_u offset=2

;; The stack contains an i64 value of 0xD6C5 = 0x000000000000D6C5