Question: ANSWER ASAP !!!! Can not use any control constructs such as if, do, while, for, switch, etc. * bitXor - x^y using only ~ and

ANSWER ASAP !!!!

Can not use any control constructs such as if, do, while, for, switch, etc.

* bitXor - x^y using only ~ and &

* Example: bitXor(6, 3) = 5

* Legal ops: ~ & |

* Max ops: 8

* Rating: 10

*/

int bitXor(int x, int y) {

return 2;

}

/*

* isEqual - return 1 if x == y, and 0 otherwise

* Examples: isEqual(5,5) = 1, isEqual(4,5) = 0

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

* Max ops: 5

* Rating: 10

*/

int isEqual(int x, int y) {

return 2;

}

/*

* notAllZeros - Check whether any bit of x is a 1.

* Examples: notAllZeros(0x00200400) = 1, notAllZeros(0x00000000) = 0

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

* Max ops: 5

* Rating: 8

*/

int notAllZeros(int x) {

return 2;

}

/*

* anyOddBit - return 1 if any odd-numbered bit in x is set to 1

* Examples anyOddBit(0x5) = 0, anyOddBit(0x7) = 1

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

* Max ops: 12

* Rating: 6

*/

int anyOddBit(int x) {

return 2;

}

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!