Hacker News new | ask | show | jobs
Why Rust doesn't need a standard div_rem: An LLVM tale (codspeed.io)
17 points by art049 984 days ago
1 comments

The 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.

Is 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.