3 ms·
This was exactly what I was about to mention; I can reproduce your results in Clang but it seems GCC doesn't want to optimize this? Here's what Godbolt gives me
by saagarjha 8y ago
This was exactly what I was about to mention; I can reproduce your results in Clang but it seems GCC doesn't want to optimize this? Here's what Godbolt gives me: https://godbolt.org/z/aFTdur https://godbolt.org/z/aFTdur
- acqq 8y agoJust write a function “mydiv10” which returns if x < 99 { x /10 and 0 otherwise and try again.
- acqq 8y agoLike this: https://godbolt.org/z/bS2yzB https://godbolt.org/z/bS2yzB But also note that when the input is unsigned short we get: https://godbolt.org/z/sbDbMU https://godbolt.org/z/sbDbMU movzx eax, di imul eax, eax, 52429 shr eax, 19