WebAssembly numeric instructions
WebAssembly numeric instructions.
In this article
Constants
constDeclare a constant numbers.
Comparison
Arithmetic
Conversion
extendConvert (extend)
i32toi64.wrapConvert (wrap)
i64toi32.promoteConvert (promote)
f32tof64.demoteConvert (demote)
f64tof32.convertConvert integers to floating points.
trunc(to int)Convert (truncate fractional part) floating points to integers.
reinterpretReinterpret the bytes of integers as floating points and vice versa.
Floating point specific instructions
minGet the lower of two numbers.
maxGet the higher of two numbers.
nearestRound a number to the nearest integer.
ceilRound up a number.
floorRound down a number.
trunc(to float)Discard the fractional part of a number.
absGet the absolute value of a number.
negNegate a number.
sqrtGet the square root of a number.
copysignCopy just the sign bit from one number to another.
Bitwise
andUsed for performing a bitwise AND.
orUsed for performing a bitwise OR.
xorUsed for performing a bitwise XOR.
shlUsed for performing a bitwise left-shift.
shrUsed for performing a bitwise right-shift.
rotlUsed for performing a bitwise left-rotate.
rotrUsed for performing a bitwise right-rotate.
clzCount the amount of leading zeros in a numbers binary representation.
ctzCount the amount of trailing zeros in a numbers binary representation.
popcntCount the total amount of 1s in a numbers binary representation.