aboutsummaryrefslogtreecommitdiff
path: root/iconv
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2019-03-20 23:56:59 -0400
committerDJ Delorie <dj@redhat.com>2019-03-21 13:47:14 -0400
commitac64195ccd4f320659fd0058bc7524c6fd0b37b4 (patch)
tree9d893046b8e37b22b212af7e4a57d2e3ac3300fd /iconv
parentS390: Mark vx and vxe as important hwcap. (diff)
downloadglibc-ac64195ccd4f320659fd0058bc7524c6fd0b37b4.tar.gz
glibc-ac64195ccd4f320659fd0058bc7524c6fd0b37b4.tar.bz2
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 'iconv')
-rw-r--r--iconv/iconvconfig.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
index 0201450742..1e6066cdf0 100644
--- a/iconv/iconvconfig.c
+++ b/iconv/iconvconfig.c
@@ -1079,9 +1079,9 @@ write_output (void)
/* Create the hashing table. We know how many strings we have.
Creating a perfect hash table is not reasonable here. Therefore
- we use open hashing and a table size which is the next prime 40%
+ we use open hashing and a table size which is the next prime 50%
larger than the number of strings. */
- hash_size = next_prime (nnames * 1.4);
+ hash_size = next_prime (nnames + nnames >> 1);
hash_table = (struct hash_entry *) xcalloc (hash_size,
sizeof (struct hash_entry));
/* Fill the hash table. */