C++Now 2018: Matt Godbolt “What Else Has My Compiler Done For Me Lately?”
CppNow · 2 位 HN 用户推荐 · 2019–2020
[0] [link] [1] [link]
— snailmailman, 2019This is not Rust specific, this is a compiler thing, both LLVM and GCC can detect sums and generate closed form formulas instead. There are other fun algorithm detections - e.g. if you try to do bitcounts yourself, LLVM will use popcnt instead. Compilers are awesome, check out Matt Godbolt's talk on this very topic: [link]
— drej, 2020