aboutsummaryrefslogtreecommitdiff
path: root/bfd/bfd.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-10-14 20:29:12 +1030
committerAlan Modra <amodra@gmail.com>2019-10-15 16:00:54 +1030
commited481f9799f2bd08a7541a5fe0a887dc5c7fd4a9 (patch)
tree35fb1ae9da0260f6ae763809a43e32e46f23e234 /bfd/bfd.c
parentb7be2d03fb2f873e0db74c84846df97787fc0dc6 (diff)
downloadgdb-ed481f9799f2bd08a7541a5fe0a887dc5c7fd4a9.zip
gdb-ed481f9799f2bd08a7541a5fe0a887dc5c7fd4a9.tar.gz
gdb-ed481f9799f2bd08a7541a5fe0a887dc5c7fd4a9.tar.bz2
Simplify power of two test
* bfd.c (bfd_check_compression_header): Check for powers of two with x == (x & -x).
Diffstat (limited to 'bfd/bfd.c')
-rw-r--r--bfd/bfd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bfd/bfd.c b/bfd/bfd.c
index af2c192..b3078ea 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -2635,7 +2635,7 @@ bfd_check_compression_header (bfd *abfd, bfd_byte *contents,
chdr.ch_addralign = bfd_get_64 (abfd, &echdr->ch_addralign);
}
if (chdr.ch_type == ELFCOMPRESS_ZLIB
- && chdr.ch_addralign == (1U << bfd_log2 (chdr.ch_addralign)))
+ && chdr.ch_addralign == (chdr.ch_addralign & -chdr.ch_addralign))
{
*uncompressed_size = chdr.ch_size;
*uncompressed_alignment_power = bfd_log2 (chdr.ch_addralign);