Name
bitand operator — Bitwise and operator
Synopsis
and-expr := and-expr & equality-expr | and-expr bitand equality-expr
The bitwise and operator requires integer or enumeration operands. It performs the usual arithmetic conversions, then does an and operation on pairs of bits in the operands, resulting in an integer.
The bitand
keyword is
interchangeable with the &
token.
Example
unsigned bitmask = 0xFFFF;
bitmask = bitmask&
~0x7E; // bitmask becomes 0xFF81
See Also
and
, and_eq
, bitor
, compl
, expression, xor
, Chapter
3, <ciso646>
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.