Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2017 Skopje Macedonia September 18 22 2017 Proceedings Part 3 Lnai 10536

Authors: Yasemin Altun ,Kamalika Das ,Taneli Mielikainen ,Donato Malerba ,Jerzy Stefanowski ,Jesse Read ,Marinka Zitnik ,Michelangelo Ceci ,Saso Dzeroski

1st Edition

3319712721, 978-3319712727

More Books

Students also viewed these Databases questions