Question: SYSTEM LEVEL: PROGRAMMING 1.Please solve the following datalab-style puzzle. /** minusOne - return a value of -1 * Legal ops: ! ~ & ^ |
SYSTEM LEVEL: PROGRAMMING 1.Please solve the following datalab-style puzzle.
- /** minusOne - return a value of -1
* Legal ops: ! ~ & ^ | + << >>
* Max ops: 2
*/
int minusOne(void) {
}
- /**
* isPower2 - returns 1 if x is a power of 2, and 0 otherwise
* Examples: isPower2(5) = 0, isPower2(8) = 1, isPower2(0) = 0
* Note that no negative number is a power of 2.
* Legal ops: ! ~ & ^ | + << >>
* Max ops: 20
*/
int isPower2(int x) {
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
