I l @ ve RuBoard |
00000011
00001101
00111011
01110111
21, 025, 0x15
85, 0125, 0x55
76, 0114, 0x4C
157, 0235, 0x9D
252
2
7
7
5
3
28
255
1 (not false is true)
1 (true and true is true)
6
1 (true or true is true)
40
In binary, the mask is 1111111 . In decimal, it's 127 . In octal, it's 0177 . In hexadecimal, it's 0x7F .
Both bitvbal *= 2 and bitval « 1 double the current value of bitval , so they are equivalent. However, mask += bitval and mask = bitval have the same effect only if bitval and mask have no bits set to on in common. For example, 2 4 is 6 , but so is 3 6.
struct tb_drives { unsigned int diskdrives : 2; unsigned int : 1; unsigned int cdromdrives : 2; unsigned int : 1; unsigned int harddrives : 2; };
struct kb_drives { unsigned int harddrives : 2; unsigned int : 1; unsigned int cdromdrives : 2; unsigned int : 1; unsigned int diskdrives : 2; };
I l @ ve RuBoard |