src/hb-dsalgs.hh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
New commits: commit 8bb97d2ce140b7fe81d0726c32e024d887e0be1c Author: Behdad Esfahbod <beh...@behdad.org> Date: Sat Nov 10 15:54:33 2018 -0500 Revert back hb_bytes_t.cmp() to the scheme it was But fix UBSan complaint. There's nothing in hb_bytes_t that guarantees lexical ordering, and ordering by length first is much faster. diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 511b2299..ce134260 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -530,14 +530,13 @@ struct hb_bytes_t inline int cmp (const hb_bytes_t &a) const { - unsigned int l = MIN(a.len, len); - if (l) /* glibc's memcmp() args are declared nonnull. Meh. */ - { - int r = memcmp (a.arrayZ, arrayZ, l); - if (r) return r; - } + if (len != a.len) + return (int) a.len - (int) len; + + if (!len) + return 0; /* glibc's memcmp() declares args non-NULL, and UBSan doesn't like that. :( */ - return a.len < len ? -1 : a.len > len ? +1 : 0; + return memcmp (a.arrayZ, arrayZ, len); } static inline int cmp (const void *pa, const void *pb) { _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz