I think I prefer the current code to the referenced wizardry. There is an upper limit on the size of strings we will be processing, so until proven wrong I think we can settle for what seems "fast enough".
The wizardry may well be faster but it's about 5 times the code length and seems to have been written by wizards for wizards.
And we'd have to change it in three places to adapt it to our fixed byte range vs. their null-termination convention.