CHAPTER 15BIT FIDDLING
You will learn about the following in this chapter:
• Operators:
~ & |^
>> <<
&= |= ^= >>= <<=
• Binary, octal, and hexadecimal number notations (a review)
• Two C facilities for handling the individual bits in a value: bitwise operators and bit fields
With C, you can manipulate the individual bits in a variable. Perhaps you are wondering why anyone would want to. Be assured that sometimes this ability is necessary, or at least useful. For example, a hardware device is often controlled by sending it a byte or two in which each bit has a particular meaning. Also, operating system information about files is often stored by using particular bits to indicate particular items. Many compression and encryption operations manipulate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access