diff mbox series

[committed] Resync inline implementation of ceil_log2 (PR 86506)

Message ID 87a7q9ezlh.fsf@arm.com
State New
Headers show
Series [committed] Resync inline implementation of ceil_log2 (PR 86506) | expand

Commit Message

Richard Sandiford July 30, 2018, 11:23 a.m. UTC
In r262961 I only updated the out-of-line copy of ceil_log2.  This patch
applies the same change to the other (inline) one.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.  Applied as obvious.

Richard


2018-07-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* hwint.h (ceil_log2): Resync with hwint.c implementation.
diff mbox series

Patch

Index: gcc/hwint.h
===================================================================
--- gcc/hwint.h	2018-05-02 08:38:14.433364094 +0100
+++ gcc/hwint.h	2018-07-30 12:21:39.204235940 +0100
@@ -242,7 +242,7 @@  floor_log2 (unsigned HOST_WIDE_INT x)
 static inline int
 ceil_log2 (unsigned HOST_WIDE_INT x)
 {
-  return floor_log2 (x - 1) + 1;
+  return x == 0 ? 0 : floor_log2 (x - 1) + 1;
 }
 
 static inline int