diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-06-17 21:01:25 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-06-17 21:01:25 +0000 |
commit | 46d33ae927892aa2fbec97dfa90f7bd9a055a1bb (patch) | |
tree | a4d54b10f7c0db155dd485fd849fee5c27f1b77c /gcc/hwint.c | |
parent | 0df965d73f62798d8b9288a27c351502edbb1831 (diff) | |
download | gcc-46d33ae927892aa2fbec97dfa90f7bd9a055a1bb.zip gcc-46d33ae927892aa2fbec97dfa90f7bd9a055a1bb.tar.gz gcc-46d33ae927892aa2fbec97dfa90f7bd9a055a1bb.tar.bz2 |
expmed.c (ceil_log2): Move from here...
* 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.
From-SVN: r188710
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 533133c..bfc5e3d 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. */ |