diff options
author | DJ Delorie <dj@redhat.com> | 2019-03-20 23:56:59 -0400 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2019-03-21 13:47:14 -0400 |
commit | ac64195ccd4f320659fd0058bc7524c6fd0b37b4 (patch) | |
tree | 9d893046b8e37b22b212af7e4a57d2e3ac3300fd /locale/programs | |
parent | 61f5e9470fb397a4c334938ac5a667427d9047df (diff) | |
download | glibc-ac64195ccd4f320659fd0058bc7524c6fd0b37b4.tar.gz glibc-ac64195ccd4f320659fd0058bc7524c6fd0b37b4.tar.xz glibc-ac64195ccd4f320659fd0058bc7524c6fd0b37b4.zip |
iconv, localedef: avoid floating point rounding differences [BZ #24372]
Two cases of "int * 1.4" may result in imprecise results, which in at least one case resulted in i686 and x86-64 producing different locale files. This replaced that floating point multiply with integer operations. While the hash table margin is increased from 40% to 50%, testing shows only 2% increase in overall size of the locale archive. https://bugzilla.redhat.com/show_bug.cgi?id=1311954 Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Diffstat (limited to 'locale/programs')
-rw-r--r-- | locale/programs/ld-collate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index bb4e2c539d..19b23c2453 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -2401,8 +2401,8 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap, runp = runp->next; } - /* Add 40% and find the next prime number. */ - elem_size = next_prime (elem_size * 1.4); + /* Add 50% and find the next prime number. */ + elem_size = next_prime (elem_size + elem_size >> 1); /* Allocate the table. Each entry consists of two words: the hash value and an index in a secondary table which provides the index |