Question: NEED THESE ASAP !!!! SOLVE EACH CODE Can not use any control constructs such as if, do, while, for, switch, etc. - bitxor Xy using
NEED THESE ASAP !!!! SOLVE EACH CODE
Can not use any control constructs such as if, do, while, for, switch, etc.



- bitxor Xy using only - and & Example: bitxorio, 31 - 3 Legal ops: -& Max Ops B Rating: 18 * int bitxor(int x, int y) { return 2: * is Equal - return 1 if x == y, and otherwise Examples: isEqua115,5) = 1, isEqual(4,5) = @ Legal ops: ! * & * + > Max ops: 5 18 Retin int is Equelint X, int y) { return 2: } { notAllzeros-Check whathar any bit of x is a 1. Examples: notAllorOS (442964GB) = 1, notallzeros(EXPPPPPP) = 8 Legal nps: ! - &* | + > Max ops: 5 Rating: B int notallZeros(int x){ return 2: { = ) 'B * anyOddBit - return 1 ir any odd-numbered bil in x is set to 1 Examples anyOddBitx5l = @, anyOddBit(x7) = 1 Legal ops: ! - &* + Max ops: 12 Rating: 6 int anyOddBit int x) { return 2: * bitCount - returns count of number of is in the bit pattern for x Examples: bitCount (5) = 2, bitCount(7) = 3 Legal ops: I - XL + > Max pps: 40 Rating: 4 int bitCount(int x} { return 2; } } & conditional - same as X Y Z Example: conditional/2,4,5) = 4 Legal opsi ! - &* | + > Max Ops: 16 Rating: 2 int conditional int x, int y, int z) { return 2: } ninusTwo - return a value of -2 Legal ops: I-&*> Max ops: 2 Rating: 10 - int ninus Two(void) { return 2: } * TMax - return maximum twa' complement integer Legal ops: I - &* | + > Max ops: 6 Rating: 18 int tmax(void) { return 2: * negale - Telurl -X Example: negute11 = -1. Legal ops: &* + > Hex ops: 5 Rating: 10 int negate(int x{ return 2; 2 } * * * * times34 multiplies by 34 * Should exactly duplicate effect of C expression (x*34), * including overflow behavior. Examples: times34(1) = 34 times34 (-1) = -34 * Legal ops: ! ~ & ^ | + > Max ops: 6 * Rating: 6 */ int times34(int x) { return 2; } /* * greaterThan10 - checks if x > 7 Returns 1 if the argument is greater than 7 and 0 otherwise. Examples: greaterThan10(-8) = 0 greaterThan10(18) = 1 greaterThan10 (10) = 0 * Legal ops: ! ~ & ^ | + > Max ops: 12 * Rating: 2 */ int greaterThan10(int x) { return 2; * * * * * - bitxor Xy using only - and & Example: bitxorio, 31 - 3 Legal ops: -& Max Ops B Rating: 18 * int bitxor(int x, int y) { return 2: * is Equal - return 1 if x == y, and otherwise Examples: isEqua115,5) = 1, isEqual(4,5) = @ Legal ops: ! * & * + > Max ops: 5 18 Retin int is Equelint X, int y) { return 2: } { notAllzeros-Check whathar any bit of x is a 1. Examples: notAllorOS (442964GB) = 1, notallzeros(EXPPPPPP) = 8 Legal nps: ! - &* | + > Max ops: 5 Rating: B int notallZeros(int x){ return 2: { = ) 'B * anyOddBit - return 1 ir any odd-numbered bil in x is set to 1 Examples anyOddBitx5l = @, anyOddBit(x7) = 1 Legal ops: ! - &* + Max ops: 12 Rating: 6 int anyOddBit int x) { return 2: * bitCount - returns count of number of is in the bit pattern for x Examples: bitCount (5) = 2, bitCount(7) = 3 Legal ops: I - XL + > Max pps: 40 Rating: 4 int bitCount(int x} { return 2; } } & conditional - same as X Y Z Example: conditional/2,4,5) = 4 Legal opsi ! - &* | + > Max Ops: 16 Rating: 2 int conditional int x, int y, int z) { return 2: } ninusTwo - return a value of -2 Legal ops: I-&*> Max ops: 2 Rating: 10 - int ninus Two(void) { return 2: } * TMax - return maximum twa' complement integer Legal ops: I - &* | + > Max ops: 6 Rating: 18 int tmax(void) { return 2: * negale - Telurl -X Example: negute11 = -1. Legal ops: &* + > Hex ops: 5 Rating: 10 int negate(int x{ return 2; 2 } * * * * times34 multiplies by 34 * Should exactly duplicate effect of C expression (x*34), * including overflow behavior. Examples: times34(1) = 34 times34 (-1) = -34 * Legal ops: ! ~ & ^ | + > Max ops: 6 * Rating: 6 */ int times34(int x) { return 2; } /* * greaterThan10 - checks if x > 7 Returns 1 if the argument is greater than 7 and 0 otherwise. Examples: greaterThan10(-8) = 0 greaterThan10(18) = 1 greaterThan10 (10) = 0 * Legal ops: ! ~ & ^ | + > Max ops: 12 * Rating: 2 */ int greaterThan10(int x) { return 2; * * * * *
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
