Question: 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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!