by SloopJon · 8y ago · 0 comments
http://bjoern.hoehrmann.de/utf-8/decoder/dfa/
I happened to come across this decoder again recently in Niels Lohmann's JSON library for C++:
https://github.com/nlohmann/json
I see that this is mentioned in a previous post:
https://lemire.me/blog/2018/05/09/how-quickly-can-you-check-...
One thing I'd like to check in the new code is whether it's as picky about things like overlong sequences as Bjoern's code is.
I believe that's what checkContinuation() is doing, based on its use of the "counts" parameters. I don't understand how it works, but I don't see any other reason for count_nibbles() to compute the '->count' member.