Closed kvanbere closed 9 years ago
If fromIntegral
is free, it could even be worth expressing isDigit
in terms of an unsigned version using fromIntegral
for the same branch reduction.
@kvanberendonck I see you haven't done benchmarks mentioned. Do you have any benchmarks you care to share to validate this change? Or testing? (or failing tests, proofs?)
As I said, it passes tests but I can't get the benchmark suite working.
There's also an alternate implementation which might be even faster for isDigit_w8:
isDigit_w8 w = (w `xor` 48) < 10
@bos
I applied this even though I can't measure a difference. c6a54d1b1893ba8167f6ec48f6936752d3fd98f3 fixes it up a little.
50% branch reduction, yeahhh.
I haven't been able to get the benchmark suite working (cyclic dependencies?) so I only ran tests for this.