From 3d1b66a35e1ab3be19335705f310b278d76d66d2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 4 Aug 2012 17:42:28 -0700 Subject: [PATCH] Speed up hb_set_digest_common_bits_t calcs --- src/hb-set-private.hh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh index 550b7f21..8beff37d 100644 --- a/src/hb-set-private.hh +++ b/src/hb-set-private.hh @@ -54,9 +54,9 @@ 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); + /* The negation here stands for ~(x-1). */ + mask &= -(1 << _hb_bit_storage (a ^ b)); + value &= mask; } inline bool may_have (hb_codepoint_t g) const { -- GitLab