Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions