Speed up hb_set_digest_lowest_bits_t calcs

This commit is contained in:
Behdad Esfahbod 2012-08-04 18:04:57 -07:00
parent 3d1b66a35e
commit 048e3b596f
1 changed files with 7 additions and 3 deletions

View File

@ -83,9 +83,13 @@ struct hb_set_digest_lowest_bits_t
} }
inline void add_range (hb_codepoint_t a, hb_codepoint_t b) { inline void add_range (hb_codepoint_t a, hb_codepoint_t b) {
/* TODO Speedup. */ if (b - a >= sizeof (mask_t) * 8 - 1)
for (unsigned int i = a; i < b + 1; i++) mask = (mask_t) -1;
add (i); else {
mask_t ma = mask_for (a);
mask_t mb = mask_for (b);
mask |= mb + (mb - ma) - (mb < ma);
}
} }
inline bool may_have (hb_codepoint_t g) const { inline bool may_have (hb_codepoint_t g) const {