Announcements and Reminders

Recording I/O ManipulatorsThe std manipulatorsWrite your own manipulatorData at the Bit LevelExample 81 – Primitive data at the bit level Example 82 – Nonprimitive data at the bit level Bitwise Operators& operatorThe bitwise and operator returns a 1 only when both bits being compared are 1. For example:  operatorThe bitwise or operator returns a 1 only when either bits being compared are 1. For example: ^ operatorThe bitwise exclusive or operator returns a 1 only when either, but not both, bits being compared are 1. For example: ~ operatorThe
bitwise not, or complement operator is a unary bitwise operator.
It returns a 1 when the bit is 0 and returns a 0 when the bit is
1. For example: << operatorThe
bitwise leftshift operator shifts bits to left the number of positions
as the righthand operand. Bits on the right are filled with
zeros. Bits on the left are lost. The leftshift operator
may be used to perform multiplication by integer powers of two.
For example, >> operatorThe
bitwise rightshift operator shifts bits to right the number of
positions as the righthand operand. Bits on the left are filled
with zeros. Bits on the right are lost. The leftshift
operator may be used to perform division by integer powers of
two. For example, The bitwise assignment operatorsThe
bitwise assignment operators: &=, =, ^=, <<=, and
>>= perform the implied operation and assign the resultant value
to the lefthand argument. Bitwise TechniquesTurn a bit onUse the or assignment bitwise operator to turn a bit on. If the bit is already turned on, the operation has no effect. Turn a bit offUse
the and assignment with the not bitwise operators to turn a bit
off. If the bit is already turned on, the operation has no effect. Toggle a bitUse the exclusive or assignment operator to turn a bit off. Test a bitUse the and operator to see if a bit is turned on. Integer_value & bit Example 84 – Bitwise operator techniques 