How can I get bitwise AND a & b for two integers a and a & b without using this operator directly?

  • one
    Faster, write someone the answer - a man, maybe now in the exam! - Igor
  • Didn't the professor take your phone away from you? So, there will be an oral part of the exam. Good luck to you. - VladD
  • @VladD, does the question make sense, or not? - Qwertiy
  • @Qwertiy, in general it would be possible, if you remove the information about the exam and leave only the question about And without & - Grundy
  • @Qwertiy: I would take up the question in a couple of hours, not earlier. In the name of supreme justice. - VladD

2 answers 2

Two hours have passed :)

Negation of bitwise OR negatives. On C

 ~(~a|~b) 

    Alternatively, poxorize xor with or:

     (a^b)^(a|b)