logoalt Hacker News

meiseltoday at 4:48 PM1 replyview on HN

If you're doing enough divisions with the same divisor, it'd be faster to do what compilers do for division by a known constant, where they multiply by an integer reciprocal and shift


Replies

magicalhippotoday at 7:08 PM

Yea that can work well. I have extensive fixed-point math experience from my days of coding 3D graphics on my 286 and up, but for some reason I can't recall I didn't consider that viable in this case.