aboutsummaryrefslogtreecommitdiff
path: root/gcc/hwint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/hwint.c')
-rw-r--r--gcc/hwint.c4
1 files changed, 2 insertions, 2 deletions
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,