src/gen-use-table.py | 5 +-- src/hb-map-private.hh | 53 ++++++++++++++++++++++++++++++++++- src/hb-ot-shape-complex-use-table.cc | 2 - src/hb-private.hh | 3 - src/hb-static.cc | 51 --------------------------------- 5 files changed, 56 insertions(+), 58 deletions(-)
New commits: commit 0a5952e8ddb3ec955496d582ef5a559a27684a0c Author: Behdad Esfahbod <beh...@behdad.org> Date: Wed Jun 6 14:55:30 2018 -0700 Move prime_for back into map This was causing problem on systems without visibility when map was used from both libharfbuzz and libharfbuzz-subset. Sigh. https://ci.appveyor.com/project/harfbuzz/harfbuzz/build/1.0.1669/job/dey47nmff0770vp3 diff --git a/src/hb-map-private.hh b/src/hb-map-private.hh index 76c40877..d3d4dded 100644 --- a/src/hb-map-private.hh +++ b/src/hb-map-private.hh @@ -105,7 +105,7 @@ struct hb_map_t /* Switch to new, empty, array. */ population = occupancy = 0; mask = new_size - 1; - prime = _hb_prime_for (power); + prime = prime_for (power); items = new_items; /* Insert back old items. */ @@ -198,6 +198,57 @@ struct hb_map_t } return tombstone == INVALID ? i : tombstone; } + + static inline unsigned int prime_for (unsigned int shift) + { + /* Following comment and table copied from glib. */ + /* Each table size has an associated prime modulo (the first prime + * lower than the table size) used to find the initial bucket. Probing + * then works modulo 2^n. The prime modulo is necessary to get a + * good distribution with poor hash functions. + */ + /* Not declaring static to make all kinds of compilers happy... */ + /*static*/ const unsigned int prime_mod [32] = + { + 1, /* For 1 << 0 */ + 2, + 3, + 7, + 13, + 31, + 61, + 127, + 251, + 509, + 1021, + 2039, + 4093, + 8191, + 16381, + 32749, + 65521, /* For 1 << 16 */ + 131071, + 262139, + 524287, + 1048573, + 2097143, + 4194301, + 8388593, + 16777213, + 33554393, + 67108859, + 134217689, + 268435399, + 536870909, + 1073741789, + 2147483647 /* For 1 << 31 */ + }; + + if (unlikely (shift >= ARRAY_LENGTH (prime_mod))) + return prime_mod[ARRAY_LENGTH (prime_mod) - 1]; + + return prime_mod[shift]; + } }; diff --git a/src/hb-private.hh b/src/hb-private.hh index 429bab00..76b7e55d 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -1232,7 +1232,4 @@ round (double x) #endif -HB_INTERNAL unsigned int _hb_prime_for (unsigned int shift); - - #endif /* HB_PRIVATE_HH */ diff --git a/src/hb-static.cc b/src/hb-static.cc index aa0871d5..e26e5c80 100644 --- a/src/hb-static.cc +++ b/src/hb-static.cc @@ -30,54 +30,3 @@ void * const _hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; /*thread_local*/ void * _hb_CrapPool[HB_NULL_POOL_SIZE / sizeof (void *)] = {}; #endif - - -/* Following comment and table copied from glib. */ -/* Each table size has an associated prime modulo (the first prime - * lower than the table size) used to find the initial bucket. Probing - * then works modulo 2^n. The prime modulo is necessary to get a - * good distribution with poor hash functions. - */ -static const unsigned int prime_mod [] = -{ - 1, /* For 1 << 0 */ - 2, - 3, - 7, - 13, - 31, - 61, - 127, - 251, - 509, - 1021, - 2039, - 4093, - 8191, - 16381, - 32749, - 65521, /* For 1 << 16 */ - 131071, - 262139, - 524287, - 1048573, - 2097143, - 4194301, - 8388593, - 16777213, - 33554393, - 67108859, - 134217689, - 268435399, - 536870909, - 1073741789, - 2147483647 /* For 1 << 31 */ -}; - -unsigned int _hb_prime_for (unsigned int shift) -{ - if (unlikely (shift >= ARRAY_LENGTH (prime_mod))) - return prime_mod[ARRAY_LENGTH (prime_mod) - 1]; - - return prime_mod[shift]; -} commit a2a1484ef93d5b5c3748b15219eca669d866b0a9 Author: David Corbett <corbett....@husky.neu.edu> Date: Wed Jun 6 12:57:28 2018 -0400 Convert Consonant_Initial_Postfixed to CONS_FINAL Consonant_Initial_Postfixed was split off of Consonant_Succeeding_Repha, so it should correspond to the same USE class, CONS_FINAL. diff --git a/src/gen-use-table.py b/src/gen-use-table.py index 413ce11d..6aa5f881 100755 --- a/src/gen-use-table.py +++ b/src/gen-use-table.py @@ -155,8 +155,7 @@ globals().update(property_values) def is_BASE(U, UISC, UGC): - # Consonant_Initial_Postfixed is new in Unicode 11; not in the spec. - return (UISC in [Number, Consonant, Consonant_Initial_Postfixed, Consonant_Head_Letter, + return (UISC in [Number, Consonant, Consonant_Head_Letter, #SPEC-DRAFT Consonant_Placeholder, Tone_Letter, Vowel_Independent #SPEC-DRAFT @@ -178,7 +177,9 @@ def is_BASE_OTHER(U, UISC, UGC): def is_CGJ(U, UISC, UGC): return U == 0x034F def is_CONS_FINAL(U, UISC, UGC): + # Consonant_Initial_Postfixed is new in Unicode 11; not in the spec. return ((UISC == Consonant_Final and UGC != Lo) or + UISC == Consonant_Initial_Postfixed or UISC == Consonant_Succeeding_Repha) def is_CONS_FINAL_MOD(U, UISC, UGC): #SPEC-DRAFT return UISC in [Consonant_Final_Modifier, Syllable_Modifier] diff --git a/src/hb-ot-shape-complex-use-table.cc b/src/hb-ot-shape-complex-use-table.cc index 9cc7d33d..14315338 100644 --- a/src/hb-ot-shape-complex-use-table.cc +++ b/src/hb-ot-shape-complex-use-table.cc @@ -281,7 +281,7 @@ static const USE_TABLE_ELEMENT_TYPE use_table[] = { /* 1A20 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1A30 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, /* 1A40 */ B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, B, - /* 1A50 */ B, B, B, B, B, MPre, MBlw, SUB, FAbv, FAbv, B, SUB, SUB, SUB, SUB, O, + /* 1A50 */ B, B, B, B, B, MPre, MBlw, SUB, FAbv, FAbv, FAbv, SUB, SUB, SUB, SUB, O, /* 1A60 */ H, VPst, VAbv, VPst, VPst, VAbv, VAbv, VAbv, VAbv, VBlw, VBlw, VAbv, VBlw, VPst, VPre, VPre, /* 1A70 */ VPre, VPre, VPre, VAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VMAbv, VAbv, FM, FM, O, O, FBlw, /* 1A80 */ B, B, B, B, B, B, B, B, B, B, O, O, O, O, O, O, _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz