From: Behdad Esfahbod Date: Tue, 11 Sep 2018 08:57:48 +0000 (+0200) Subject: [random] Switch to 32bit RNG X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cfdea884754ed40ffa5cc00cb1ecaa86cb46a394;p=platform%2Fupstream%2FlibHarfBuzzSharp.git [random] Switch to 32bit RNG --- diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index cb71759..eae73ce 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -484,7 +484,7 @@ struct hb_ot_apply_context_t : bool auto_zwj; bool random; - uint64_t random_state; + uint32_t random_state; hb_ot_apply_context_t (unsigned int table_index_, @@ -523,8 +523,9 @@ struct hb_ot_apply_context_t : inline uint32_t random_number (void) { - random_state = (0x5DEECE66Dull * random_state + 11) & (((uint64_t) 1 << 48) - 1); - return random_state >> 32; + /* http://www.cplusplus.com/reference/random/minstd_rand/ */ + random_state = random_state * 48271 % 2147483647; + return random_state; } inline bool diff --git a/test/shaping/data/in-house/tests/rand.tests b/test/shaping/data/in-house/tests/rand.tests index 5ea0fc0..df324b9 100644 --- a/test/shaping/data/in-house/tests/rand.tests +++ b/test/shaping/data/in-house/tests/rand.tests @@ -1,3 +1,3 @@ ../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names --features=-rand:U+0054,U+0055,U+0056:[1=0+560|2=1+602|3=2+602] -#../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names --features=rand=2:U+0054,U+0055,U+0056:[5=0+560|8=1+602|11=2+602] -../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names:U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056:[6=0+560|9=1+602|10=2+602|6=3+560|9=4+602|12=5+602|5=6+560|8=7+602|11=8+602|6=9+560|8=10+602|10=11+602] +../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names --features=rand=2:U+0054,U+0055,U+0056:[5=0+560|8=1+602|11=2+602] +../fonts/5bb74492f5e0ffa1fbb72e4c881be035120b6513.ttf:--no-glyph-names:U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056,U+0054,U+0055,U+0056:[5=0+560|7=1+602|10=2+602|4=3+560|7=4+602|10=5+602|6=6+560|9=7+602|10=8+602|5=9+560|8=10+602|12=11+602]