bitand operator

   
bitand operator Bitwise and operator

  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>

   


C++ in a Nutshell
C++ in a Nutshell
ISBN: 059600298X
EAN: 2147483647
Year: 2005
Pages: 270
Authors: Ray Lischner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net