You need to OR those bits together:
http://en.wikipedia.org/wiki/Operators_in_C_and_C++#Bitwise_operators[
^].
For example
1 | (1<<1) | (1<<3)
gives you 11 (zero, first and third bits a are set, other bits are clear). You can also OR ('|', '|=')any bit set to previously assigned value:
existingBitSet |= bitsToSet;
For clearing bits, first OR them together (obtain
bitsToClear
, see below) and than use the operators '& ('&=') and ~ (not):
existingBitSet &= ~bitsToClear;
See also:
http://en.wikipedia.org/wiki/Bit_manipulation[
^].
—SA