I'm not too concerned about perf of this, I'm much more interested in how
easy it is for others to figure out what's going on. It took me a couple
times reading it over to figure it out, which is usually a sign that a
simpler approach would be better. I'd prefer to not use bitwise operators
for this.