Question
In this task, you are required to use several applications of bitwise operators. It is composed of several functions that must perform certain bitwise operations.
In this task, you are required to use several applications of bitwise operators. It is composed of several functions that must perform certain bitwise operations.
Implement the following basic bit manipulation functions that
1. prints the bit values of a byte b on the standard output (using printf function).
o function declaration void op_print_byte(unsigned char b);
For example, if b = 0x3a it should print 00111010
2. sets a bit in a 32-bit number.
o function declaration void op_bit_set(uint32_t data, int i);
o argument i is the index of the bit to be set.
3. clears a bit in a 32-bit number.
o function declaration void op_bit_clear(uint32_t data, int i);
o argument i is the index of the bit to be cleared.
4. toggles a bit in a 32-bit number.
o function declaration void op_bit_toggle(uint32_t data, int i);
o argument i is the index of the bit to be toggled.
5. returns the value of a bit in a 32-bit number.
o function declaration uint8_t op_bit_get(uint32_t data, int i);
o argument i is the index of the bit to be returned.
o The function should return 1 if the bit is set, 0 otherwise.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started