From 02e5e583688999c4dc04f11b3924da65f99af7e3 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 16 Apr 2013 23:13:10 -0400 Subject: [PATCH] Speed up Speed up hb_set_digest_common_bits_t calcs Correctly this time. --- src/hb-set-private.hh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index d9e0d29..8f741b0 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -54,9 +54,11 @@ struct hb_set_digest_common_bits_t } inline void add_range (hb_codepoint_t a, hb_codepoint_t b) { - /* TODO Speedup. */ - for (unsigned int i = a; i < b + 1; i++) - add (i); + add (a); + /* The negation here stands for ~(x-1). */ + mask_t upper_bits = -(1 << _hb_bit_storage (a ^ b)); + mask &= upper_bits; + value &= upper_bits; } inline bool may_have (hb_codepoint_t g) const { -- 2.7.4