Optimized branching in g_utf8_validate()
commit3188b8ee791a38ac3dd7e477f30761344442f745
authorMikhail Zabaluev <mikhail.zabaluev@gmail.com>
Mon, 13 Oct 2014 22:18:57 +0000 (14 01:18 +0300)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 5 Sep 2015 17:10:57 +0000 (5 13:10 -0400)
tree29f65564e190372b8fbc929b5c50bc6e1f166766
parent5644ee5083c5f03e01ee2e4de615c16cfc0dfcd0
Optimized branching in g_utf8_validate()

The number of branches and logical operations can be reduced by
never producing a resulting wide character value to check its range.
Instead, individual bytes in the sequence are validated
depending on the branch taken on the basis of preceding bytes.
The syntax given in RFC 3629 is made use of.

https://bugzilla.gnome.org/show_bug.cgi?id=738504
glib/gutf8.c