This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]