bit mask


Also found in: Wikipedia.

bit mask

(programming)
A pattern of binary values which is combined with some value using bitwise AND with the result that bits in the value in positions where the mask is zero are also set to zero. For example, if, in C, we want to test if bits 0 or 2 of x are set, we can write

int mask = 5; /* binary 101 */

if (x & mask) ...

A bit mask might also be used to set certain bits using bitwise OR, or to invert them using bitwise exclusive OR.
References in periodicals archive ?
This is a bit mask that is used to determine the network address of a given IP address and the host/node address.
Two data triggers with bit mask and range facilities -- ideal for tracking down code that accesses critical data.