diff options
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/hwint.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3a27804..bb9f506 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2018-07-25 Richard Sandiford <richard.sandiford@arm.com> + + * hwint.c (ceil_log2): Fix comment. Return 0 for 0. + 2018-07-25 Martin Liska <mliska@suse.cz> PR middle-end/86645 diff --git a/gcc/hwint.c b/gcc/hwint.c index 7258df7..b10b5e4 100644 --- a/gcc/hwint.c +++ b/gcc/hwint.c @@ -60,12 +60,12 @@ floor_log2 (unsigned HOST_WIDE_INT x) return t; } -/* Given X, an unsigned number, return the largest Y such that 2**Y >= X. */ +/* Given X, an unsigned number, return the least Y such that 2**Y >= X. */ int ceil_log2 (unsigned HOST_WIDE_INT x) { - return floor_log2 (x - 1) + 1; + return x == 0 ? 0 : floor_log2 (x - 1) + 1; } /* Return the logarithm of X, base 2, considering X unsigned, |