re: Bit Hacking with Go VIEW POST


Thanks Vladimir for this overview!
I have 2 comments:

  • there seems to be a typo in the introduction. it says '&' which should probably be '&'
  • the example of using 'AND NOT' to clear the 4 LSB's. do people do this? isn't it easier to just 'AND' against 0xF0 ? I tried it and it seems to provide the same outcome

thanks again,


Hi Dieter,
Thanks for taking time to read and asking questions.

  • You are right, it is a typo, it should be &^ (thanks for catching that)
  • yes the AND and &^ have the same effect in some situations as you pointed out. Their usage will depend on context of what you want to achieve and which one makes the expression you are constructing easier.
code of conduct - report abuse