Bitwise Operations

Mathematica can represent bit vectors of arbitrary length as integers, and uses highly optimized algorithms—including several original to Wolfram Research—to perform bitwise operations with maximal efficiency on all standard computer systems.

ReferenceReference

Bitwise Logic Operations

BitAnd ▪ BitOr ▪ BitXor ▪ BitNot

Structural Bitwise Operations

BitLength ▪ BitShiftLeft ▪ BitShiftRight

Single-Bit Operations

BitSet ▪ BitClear ▪ BitGet

DigitCount total count of 0 or 1 bits

IntegerExponent number of trailing 0s

CellularAutomaton arbitrary local bitwise operations

IntegerDigits convert to a list of digits

FromDigits convert to an integer from a list of digits

New to Mathematica? Find your learning path »
Have a question? Ask support »