4 ms·
Why Rust doesn't need a standard div_rem: An LLVM tale
- patrakov 3y agoThe answer from the article is that the IR optimizer, acting on the LLVM bitcode, is able to combine the separate lines for getting the quotient and the remainder into one assembly instruction. The problem with the article is that the same argument applies to any sufficiently good optimizing compiler, and therefore it is not obvious at all why C needs the div() function and Rust does not.
- art049 3y agoIs it needed in C? I think it's just a specification difference since most compilers should be able to do the same job, clang and gcc at least.