User Guide

~ (bitwise NOT) 69
/* To set the read-only flag in the flags variable, the following code uses the
bitwise OR: */
flags |= ReadOnlyFlag;
trace(flags);
/* To clear the read-only flag in the flags variable, first construct a mask by
using bitwise NOT on ReadOnlyFlag. In the mask, every bit is a 1 except for
the read-only flag. Then, use bitwise AND with the mask to clear the read-
only flag. The following code constructs the mask and performs the bitwise
AND: */
flags &= ~ReadOnlyFlag;
trace(flags);
/* output:
0
1
0
*/
See also
& (bitwise AND), &= (bitwise AND assignment), ^ (bitwise XOR), ^= (bitwise XOR
assignment), | (bitwise OR), |= (bitwise OR assignment)