I don't understand how this can work: there are 15 (or 7 :-) other characters with the same bottom four bits as each digit. How does it distinguish between, say, '4' and 't'? Space and '0' have the same lower four bits: \0!
part1 = _pext_u64(part1, 0x0f0f0f0f0f0f0f0f);
part2 = _pext_u64(part2, 0x0f000f0f0f0f0f0f);
You are right that if you were to use a space in an unexpected position, the code wouldn't work.So this solution only works when the digit character places are fixed and known.
It would be possible to generate mask based on the first nibbles so that it would ignore non-digits. Maybe even with some fairly optimized vector instructions. Not sure would it be faster than some naive solution.
Specifically the line: `part2 = _pext_u64(part2, 0x0f000f0f0f0f0f0f);` seems to mask out that character.