In this lecture, we cover bitwise operators in
Go: how to think of integers as sets of bits, what flags and masks are, how to create masks via
1
<<
n, set flags via
|, check via
&, clear via
&^, and also how to debug masks by printing
%b and
%08b. At the end, there is a cheat sheet and common mistakes.