Question: Please explain this bit-wise operation line by line Thank you! * * * * = * = 1 * /* howManyBits - return the minimum

Please explain this bit-wise operation line by line Thank you!

Please explain this bit-wise operation line by line Thank you! * ** * = * = 1 * /* howManyBits - return the

* * * * = * = 1 * /* howManyBits - return the minimum number of bits required to represent x in two's complement Examples: howManyBits (12) = 5 howManyBits (298) = 10 howManyBits(-5) = 4 howManyBits(0) 1 howManyBits(-1) howManyBits (0x80000000) = 32 * Legal ops: ! ~&^ | + >> Max ops: 90 * Rating: 4 */ int howManyBits(int x) { int n = 0; x = x ^ (x >> 31); n = n + ((!!(x >> (n + 16))) 4); n = n + ((!!(x >> (n + 8))) > (n + 4))) > (n + 2))) > (n + 1)))); n = n + (x >> n); return n + 1; } * * /* * float_abs - Return bit-level equivalent of absolute value of f for floating point argument f. Both the argument and result are passed as unsigned int's, but they are to be interpreted as the bit-level representations of single-precision floating point values. When argument is Nan, return argument.. Legal ops: Any integer/unsigned operations incl. ||, &&. also if, while Max ops: 10 Rating: 2 */ unsigned float_abs(unsigned uf) { * * unsigned x = uf & 0x7FFFFFFF; return x > 0x7F800000 ? uf : x; }

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!