Efficient integer floor function in C++
Casting to int is notoriously slow. Maybe you’ve been living under a rock since x86-64, or otherwise missed that this hasn’t been true for a while on x86. 🙂 SSE/SSE2 have an instruction to convert with truncation (instead of the default rounding mode). The ISA supports this operation efficiently precisely because conversion with C semantics … Read more