Exercise 4: Bit Manipulation
-
Write a function to display
uint32 values as 01010110...
char *showBits(uint32 val, char *buf);
|
Analogous to gets() (assumes supplied buffer large enough)
-
Write a function to extract the d bits of a
uint32
uint32 bits(int d, uint32 val);
|
If d > 0, gives low-order bits; if d < 0, gives high-order bits
|