 
                            ...
This noncompliant code example demonstrates how performing bitwise operations on integer types smaller than int may have unexpected results.
| Code Block | ||||
|---|---|---|---|---|
| 
 | ||||
| uint8_t port = 0x5a; uint8_t result_8 = ( ~port ) >> 4; | 
...
In this compliant solution, the bitwise complement of port is converted back to 8 bits. Consequently, result_8 is assigned the expected value of 0x0aU.
| Code Block | ||||
|---|---|---|---|---|
| 
 | ||||
| uint8_t port = 0x5a; uint8_t result_8 = (uint8_t) (~port) >> 4; | 
...