What does the ^ operator do to a BOOL?

后端 未结 7 1784
情深已故
情深已故 2021-01-23 04:10

What does this statement mean?

isChecked = isChecked ^ 1;

isChecked is a BOOL.

7条回答
  •  醉酒成梦
    2021-01-23 04:41

    Everyone is saying it XORs the bool-- that's true-- but the purpose here is that it's toggling the bool.

    The advantage of doing a bitwise toggle like this is speed and the ability to fiddle bits in extreme detail.

    for more Bitwise Operators

提交回复
热议问题