Exercise: Bitwise NOT
Explore how to apply the bitwise NOT operation on two-byte unsigned and signed integers through practical exercises in Bash. Understand differences in results due to number representation and overflow, and verify outcomes using Bash commands.
Exercise
Apply bitwise NOT for the following unsigned two-byte integers:
- 56
- 1018
- 58362
Repeat the calculations for the case when these are the signed integers.
Solution
First, let us calculate bitwise NOT for unsigned two-byte integers.
56 = 0000 0000 ...