From: Behdad Esfahbod Date: Tue, 11 Sep 2018 08:51:19 +0000 (+0200) Subject: [random] Shuffle X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=08260c708ae6adc4efa9bde5e9ede01b7e4d42cc;p=platform%2Fupstream%2FlibHarfBuzzSharp.git [random] Shuffle --- diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index dfa5097..4d5db6a 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -543,10 +543,7 @@ struct AlternateSet /* If alt_index is MAX, randomize feature if it is the rand feature. */ if (alt_index == HB_OT_MAP_MAX_VALUE && c->random) - { - c->random_state = (0x5DEECE66Dull * c->random_state + 11) & (((uint64_t) 1 << 48) - 1); - alt_index = (c->random_state >> 32) % count + 1; - } + alt_index = c->random_number () % count + 1; if (unlikely (alt_index > count || alt_index == 0)) return_trace (false); diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index be1b449..cb71759 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -521,6 +521,12 @@ struct hb_ot_apply_context_t : iter_context.init (this, true); } + inline uint32_t random_number (void) + { + random_state = (0x5DEECE66Dull * random_state + 11) & (((uint64_t) 1 << 48) - 1); + return random_state >> 32; + } + inline bool match_properties_mark (hb_codepoint_t glyph, unsigned int glyph_props,