Course Solutions Uncategorized (Solved) : Answer Chegg Wrong Error Code Error Test Satmul2 2147483648 0x80000000 Failed Gives 214748 Q26367838 . . . .

(Solved) : Answer Chegg Wrong Error Code Error Test Satmul2 2147483648 0x80000000 Failed Gives 214748 Q26367838 . . . .

 

The other answer on Chegg is wrong with this error code:

“ERROR: Test satMul2(-2147483648[0x80000000]) failed…

…Gives -2147483648[0x80000000]. Should be 0[0x0]”

please give the correct answer in C

Tmin = 0x7FFFFFFF

Tmax = 0x80000000

/*

* satMul2 – multiplies by 2, saturating to Tmin or Tmax ifoverflow

* Examples: satMul2(0x30000000) = 0x60000000

* satMul2(0x40000000) = 0x7FFFFFFF (saturate to TMax)

* satMul2(0x60000000) = 0x80000000 (saturate to TMin)

* Legal ops: ! ~ & ^ | + << >>

* Max ops: 20

* Rating: 3

*/

int satMul2(int x) {

}

You are expressly forbidden to:

1. Use any control constructs such as if, do, while, for,switch, etc.

2. Define or use any macros.

3. Define any additional functions in this file.

4.

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post