Left shift
The shl
instructions, short for shift-left, are used for performing a bitwise left-shift, similar to the <<
operator in other languages.
Try it
Syntax
wasm
;; load two numbers onto the stack
i32.const 7 ;; 00000111
i32.const 1 ;; left shift one spot
;; perform a bitwise left-shift
i32.shl
;; the top item on the stack will now be 14 (00001110)
Instruction | Binary opcode |
---|---|
i32.shl |
0x74 |
i64.shl |
0x86 |