Page t015, go to NEXT,
PREVIOUS, INDEX
Bitwise Operators
List of bitwise operators
Purpose | Operator example
|
---|
complement | ~i
|
and | i&j
|
exclusive or | i^j
|
inclusive or | i|j
|
shift left | i<<n
|
shift right | i>>n
|
- can be used on any integer type (char,
short, int, etc.)
- right shift might not do sign extension
- used for unpacking compressed data
C Course, 20-jan-1997,
Peter Klok,
pfk@hef.kun.nl