diff options
author | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-17 21:01:25 +0000 |
---|---|---|
committer | steven <steven@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-06-17 21:01:25 +0000 |
commit | f80de6c27b798006b103299b64959a378490cebe (patch) | |
tree | a4d54b10f7c0db155dd485fd849fee5c27f1b77c /gcc/hwint.c | |
parent | 6df834069ead41bce52c7f450daf4a5fa6f19b8d (diff) | |
download | gcc-f80de6c27b798006b103299b64959a378490cebe.tar.gz |
* expmed.c (ceil_log2): Move from here...
* hwint.c: ... to here for older GCCs...
* hwint.h: ... and here for newer GCCs.
* rtl.h (ceil_log2): Remove prototype.
* tree-phinodes.c: Do not include rtl.h.
* Makefile.in (tree-phinodes.o): Do not depend on RTL_H.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188710 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/hwint.c')
-rw-r--r-- | gcc/hwint.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/hwint.c b/gcc/hwint.c index 533133c7b4d..bfc5e3dedcd 100644 --- a/gcc/hwint.c +++ b/gcc/hwint.c @@ -25,10 +25,11 @@ along with GCC; see the file COPYING3. If not see #if GCC_VERSION < 3004 -/* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2 and exact_log2 - are defined as inline functions in hwint.h if GCC_VERSION >= 3004. - The definitions here are used for older versions of GCC and non-GCC - bootstrap compilers. */ +/* The functions clz_hwi, ctz_hwi, ffs_hwi, floor_log2, ceil_log2, + and exact_log2 are defined as inline functions in hwint.h + if GCC_VERSION >= 3004. + The definitions here are used for older versions of GCC and + non-GCC bootstrap compilers. */ /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X. If X is 0, return -1. */ @@ -61,6 +62,14 @@ floor_log2 (unsigned HOST_WIDE_INT x) return t; } +/* Given X, an unsigned number, return the largest Y such that 2**Y >= X. */ + +int +ceil_log2 (unsigned HOST_WIDE_INT x) +{ + return floor_log2 (x - 1) + 1; +} + /* Return the logarithm of X, base 2, considering X unsigned, if X is a power of 2. Otherwise, returns -1. */ |