summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/malloc.c
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2008-08-14 17:03:29 +0000
committerjasone <jasone@FreeBSD.org>2008-08-14 17:03:29 +0000
commitdb987f53e41294a5c44b182ea755e18f2a5ab7ff (patch)
treebd05bf01a8d2d76775f7f43816f6684451a63046 /lib/libc/stdlib/malloc.c
parent7596287674be5b9c91876257d7e78f2992cf31c8 (diff)
downloadFreeBSD-src-db987f53e41294a5c44b182ea755e18f2a5ab7ff.zip
FreeBSD-src-db987f53e41294a5c44b182ea755e18f2a5ab7ff.tar.gz
Re-order the terms of an expression in arena_run_reg_dalloc() to correctly
detect whether the integer division table is large enough to handle the divisor. Before this change, the last two table elements were never used, thus causing the slow path to be used for those divisors.
Diffstat (limited to 'lib/libc/stdlib/malloc.c')
-rw-r--r--lib/libc/stdlib/malloc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 21504a1..9d0d3b3 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -2209,8 +2209,8 @@ arena_run_reg_dalloc(arena_run_t *run, arena_bin_t *bin, void *ptr, size_t size)
*/
regind = diff / size;
}
- } else if (size <= ((sizeof(size_invs) / sizeof(unsigned))
- << QUANTUM_2POW_MIN) + 2) {
+ } else if (size <= (((sizeof(size_invs) / sizeof(unsigned)) + 2)
+ << QUANTUM_2POW_MIN)) {
regind = size_invs[(size >> QUANTUM_2POW_MIN) - 3] * diff;
regind >>= SIZE_INV_SHIFT;
} else {
OpenPOWER on IntegriCloud