2

BitField1 = 00100110

BitField2 = 00110011

((BitField1 & ~BitField2) | (BitField2 & ~BitField1)); = 00010101

So this is the long version of a common bitwise operation, what is it?

Want to understand if above bit operation is some known operation ?

Naeem Ul Wahhab
  • 2,465
  • 4
  • 32
  • 59
sasha
  • 71
  • 8

1 Answers1

2

This is XOR. You end up with a 1 in those bits where either BitField1, or BitField2, but not both, have a 1.

As Wikipedia says, one use is

"Assembly language programmers sometimes use XOR as a short-cut to setting the value of a register to zero. Performing XOR on a value against itself always yields zero."

perigon
  • 2,160
  • 11
  • 16