Anyone interested in branch-free code might like the book Hacker's Delight. Lots of examples of stuff like this in there.

Highly recommend. The exampels are in c/c++ and the same concepts can be ported to other languages like golang.

My favorite part of it is Chapter 2 the bit manipulation tricks.