Question: Write a function which returns a 3 2 - bit unsigned integer in which every bit is zero except for a specific range of bits

Write a function which returns a 32-bit unsigned integer in which every bit is zero except for a specific range of bits which are set to one. The function takes two arguments, start and end. You may assume 0<= start < end <=32. Every bit starting from start and ending before end should be 1 and every other bit should be 0. The two arguments both count from the leftmost bit of the number.

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!