WebAssembly numeric instructions
WebAssembly numeric instructions.
Constants
Const

Declare a constant numbers.
Comparison
Equal

Check if two numbers are equal.
Not equal

Check if two numbers are not equal.
Greater than

Check if a number is greater than another number.
Less than

Check if a number is less than another number.
Greater or equal

Check if a number is greater than or equal to another number.
Less or equal

Check if a number is less than or equal to another number.
Arithmetic
Addition

Add up two numbers.
Subtraction

Subtract one number from another number.
Multiplication

Multiply one number by another number.
Division

Divide one number by another number.
Remainder

Calculate the remainder left over when one integer is divided by another integer.
Conversion
Extend

Convert (extend)
i32
toi64
. Wrap

Convert (wrap)
i64
toi32
. Promote

Convert (promote)
f32
tof64
. Demote

Convert (demote)
f64
tof32
. Convert

Convert integers to floating points.
Truncate (float to int)

Convert (truncate fractional part) floating points to integers.
Reinterpret

Reinterpret the bytes of integers as floating points and vice versa.
Floating point specific instructions
Min

Get the lower of two numbers.
Max

Get the higher of two numbers.
Nearest

Round a number to the nearest integer.
Ceil

Round up a number.
Floor

Round down a number.
Truncate (float to float)

Discard the fractional part of a number.
Absolute

Get the absolute value of a number.
Negate

Negate a number.
Square root

Get the square root of a number.
Copy sign

Copy just the sign bit from one number to another.
Bitwise
AND

Used for performing a bitwise AND.
OR

Used for performing a bitwise OR.
XOR

Used for performing a bitwise XOR.
Left shift

Used for performing a bitwise leftshift.
Right shift

Used for performing a bitwise leftshift.
Left rotate

Used for performing a bitwise leftrotate.
Right rotate

Used for performing a bitwise rightrotate.
Count leading zeros

Count the amount of leading zeros in a numbers binary representation.
Count trailing zeros

Count the amount of trailing zeros in a numbers binary representation.
Population count

Count the total amount of 1s in a numbers binary representation.