4 ms·
I haven't read this properly, and I'm not sure I totally understand the stuff being parsed, but here's my initial thought. Parsing a 4-digit span can be done wi
by plastic_teeth 6y ago
I haven't read this properly, and I'm not sure I totally understand the stuff being parsed, but here's my initial thought. Parsing a 4-digit span can be done with PEXT-sub-multiply, and range checking requires a extra few instructions.
initial: 0 0 0 0 3 4 1 2 (characters)
pext: 0 3 0 4 0 1 0 2 (characters)
sub: 0 3 0 4 0 1 0 2
multiply: 3412 412 12 2
Values below '0' will set high bits in the "sub" phase. Do another "sub" to check for values above '9', and branch.
Use of PEXT means potentially very fast handling of separators. Everything can be branchless.
Might not be as fast as SIMD but it should be better than a typical scalar approach.