On Thursday, 27 February 2020 at 03:58:15 UTC, Bruce Carneal
wrote:
Maybe you talked about another implementation of
decimalLength9 ?
Yes. It's one I wrote after I saw your post. Psuedo-code here:
auto d9_branchless(uint v) { return 1 + (v >= 10) + (v >=
100) ... }
Using ldc to target an x86 with the above yields a series of
cmpl, seta instruction pairs in the function body followed by a
summing and a return. No branching.
Let me know if the above is unclear or insufficient.
No thanks, it's crystal clear now.