Question: This exercise is about the bit-wise operators in C. Complete each function skeleton using only straight-line code (i.e., no loops, conditionals, or function calls) and
This exercise is about the bit-wise operators in C. Complete each function skeleton using only straight-line code (i.e., no loops, conditionals, or function calls) and limited of C arithmetic and logical C operators. Specifically, you can only allowed to use the following eight operators: ! & | + >. A specific problem may restrict the list further: For example, write a function to compute the bitwise xor of x and y, only using & |, 

(2) This exercise is about the bit-wise operators in C. Complete each function skeleton using only straight-line code (i.e., no loops, conditionals, or function calls) and limited of C arithmetic and logical C operators. Specifically, you ly allowed to use the following eight operators: ! ~& + >. A specific problem may restrict the list further: For example, write a function to compute the bitwise xor of x and y, only using & , ~ int bitXor(int x, int y) { return ((x&~y) | (~x & y));} (a) int bitAnd(int x, int y) /* Using only {return 2; } ~ */ (b) int minus1(void) {return 2; } (c) int isPositive(int x) /* returns 1 if x>0 , 0 otherwise */ { return 2;} (d) int neg8(int x) /* returns -x without using the - sign*/ { return 2;}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
