From 9e6619e285873fe1cb002da4bb7749be40a5627c Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 20 Apr 2011 07:17:01 +0000 Subject: * libbfd.c (bfd_log2): Do return rounded up value. * elflink.c (bfd_elf_size_dynsym_hash_dynstr): Replace bfd_log2 call with expanded old round down version of the function. --- bfd/libbfd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bfd/libbfd.c') diff --git a/bfd/libbfd.c b/bfd/libbfd.c index 4e5813a..cec13d9 100644 --- a/bfd/libbfd.c +++ b/bfd/libbfd.c @@ -979,8 +979,12 @@ bfd_log2 (bfd_vma x) { unsigned int result = 0; - while ((x = (x >> 1)) != 0) + if (x <= 1) + return result; + --x; + do ++result; + while ((x >>= 1) != 0); return result; } -- cgit v1.1