4 ms·
Yes, for constant divisors. However, for signed division, the C semantics (round towards zero) are different than the semantics when you apply an arithmetic sh
by BeeOnRope 7y ago
Yes, for constant divisors.
However, for signed division, the C semantics (round towards zero) are different than the semantics when you apply an arithmetic shift (round towards negative infinity).
If you are fine with the latter behavior explicit shifts remove several extraneous instructions dealing with the difference.
- caf 7y agoOr you can do the division in unsigned types - reasonable for something like an array index.