Main Content

Bit-Wise Operations

Set, shift, or compare specific bit fields

Bit-wise operators are used to change the bit patterns of numbers. These operations are efficient since they are directly supported by most CPUs. For more information, see Bit-Wise Operations.

Functions

bitandBit-wise AND
bitorBit-wise OR
bitxorBit-wise XOR
bitcmpBit-wise complement
bitgetGet bit at specified position
bitsetSet bit at specific location
bitshiftShift bits specified number of places
swapbytesSwap byte ordering

Topics

Bit-Wise Operations

This topic shows how to use bit-wise operations in MATLAB® to manipulate the bits of numbers.

Perform Cyclic Redundancy Check

This example shows how to perform a cyclic redundancy check (CRC) on the bits of a number.