Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a subroutine called bit merge, that accepts two four digit hexadecimal numbers (16 bits each) as input and combines their bits into a single
Write a subroutine called bit merge, that accepts two four digit hexadecimal numbers (16 bits each) as input and combines their bits into a single 32 bit number as follows void main () unsianed short hn 1 = 0x1234; unsigned short hn2 0xabcd; int result result -bit_merge (hnl, hn2) printf(" merging 0x%x and Ox%x result) results in 0x#x ", hnl, hn2, The output should look like: merging 0x1234 and Oxabcd results in Oxabcd1234 To do this requires a left shift of hn2 by 16 bits and then a bitwise OR ofhnl with the left-shifted hn2. Remember that hn2 needs to be left shifted into a 32 bit variable, or all the data will be lost when shifted. Be careful of data types (int versus unsigned short), and think about what is going on at a bit level
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