by rustybolt · 6y ago · 0 comments
https://ridiculousfish.com/blog/posts/labor-of-division-epis... and https://ridiculousfish.com/blog/posts/labor-of-division-epis... also explain this (and are probably better written than my blogpost).
For anyone curious like I was:
Minor nit, there's a typo here in the power-of-two example:
uint divide(uint n) {
return n << p;
}
the shifts should be to the right, obviously.