2 ms·
An oldie but goodie. In practice, compilers are pretty good at working this out for you, provided the denominator is a constant expression. In other words, if y
by pmjordan 17y ago
An oldie but goodie. In practice, compilers are pretty good at working this out for you, provided the denominator is a constant expression. In other words, if you're burning cycles because of a division with variable but rarely-changing denominator in an inner loop, it can make sense to precompute the equivalent multiplication factor and perform the multiplication explicitly.