- Nov 9, 2011
- 355
- 0
- 0
My objective here is to write functions that perform bitwise binary and unary operations. I just need to get an idea of how I can perform these, I really have no idea.
For example, I need to write a bitwise OR of x and y. I know in code it would be set like this:
int randomVar = x | y
But, I cannot do this. I'm not allowed to use the | operator. I'm only allowed to use the NOT(~) and AND(&) operators. And I cannot use any kind of loop either. I'm really confused with this.
Any help? I would really not prefer an actual answer, but more of a prod in the right direction.
For example, I need to write a bitwise OR of x and y. I know in code it would be set like this:
int randomVar = x | y
But, I cannot do this. I'm not allowed to use the | operator. I'm only allowed to use the NOT(~) and AND(&) operators. And I cannot use any kind of loop either. I'm really confused with this.
Any help? I would really not prefer an actual answer, but more of a prod in the right direction.
