Question: In C++ Write a subroutine called bit merge, that accepts two four digit hexadecimal numbers (16 bits each) as input and combines their bits into
In C++

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) unsigned short hn1 = 0x1234; unsigned short hn2 = 0xabca; int result; merge (hn1, hn2); printf(" merging result results bit 0x%x and 0x%x hnl, hn2, result); The output should look like merging Ox1234 and Oxabed results in Oxabcd1234 To do this requires a left shift of hn2 by 16 bits and then a bitwise OR of hnl 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
Get step-by-step solutions from verified subject matter experts
