ESE 381 Lecture Notes - Lecture 2: Bitwise Operation, C Preprocessor, C Data Types
Document Summary
Embedded systems typically must manipulate individual bits in registers, memory, and. I/o ports to carry out more complex tasks. C has two facilities for manipulating bits: Four bitwise logic operators and two bitwise shift operators. Field data form (structures with bit fields) C provides four bitwise logical operators that allow us to manipulate individual bits in a variable (register, port, or memory location) Bitwise operators work only on integer data types, including char. Operators are called bitwise as they operate on each bit independently of the bit to its left or right. Bitwise operators on signed integers usually work the same way as bitwise operators on unsigned integers, the sign bit is treated as any other bit. The various c standards do not specify the size in bits of the different integer data types. You want to choose sizes for your program variables that are big enough.