Fixing sector_div
Fixing sector_div
Posted May 25, 2015 17:01 UTC (Mon) by josh (subscriber, #17465)In reply to: Fixing sector_div by cesarb
Parent article: A tale of two data-corruption bugs
> The whole point of that macro is to avoid doing the same division twice. Replacing it with a single macro with a different calling convention would be acceptable, replacing it with two separate operations would be a harder sell.
Compilers are smart enough to notice and coalesce div and mod on the same operands and implement them with a single instruction on architectures with such an instruction.
