summaryrefslogtreecommitdiff
path: root/gcc/hwint.h
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-17 21:01:25 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-17 21:01:25 +0000
commitf80de6c27b798006b103299b64959a378490cebe (patch)
treea4d54b10f7c0db155dd485fd849fee5c27f1b77c /gcc/hwint.h
parent6df834069ead41bce52c7f450daf4a5fa6f19b8d (diff)
downloadgcc-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.h')
-rw-r--r--gcc/hwint.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/hwint.h b/gcc/hwint.h
index 17346392f91..00c9538fb11 100644
--- a/gcc/hwint.h
+++ b/gcc/hwint.h
@@ -185,6 +185,9 @@ extern int exact_log2 (unsigned HOST_WIDE_INT);
/* Return floor of log2, with -1 for zero. */
extern int floor_log2 (unsigned HOST_WIDE_INT);
+/* Return the smallest n such that 2**n >= X. */
+extern int ceil_log2 (unsigned HOST_WIDE_INT);
+
#else /* GCC_VERSION >= 3004 */
/* For convenience, define 0 -> word_size. */
@@ -235,6 +238,12 @@ floor_log2 (unsigned HOST_WIDE_INT x)
}
static inline int
+ceil_log2 (unsigned HOST_WIDE_INT x)
+{
+ return floor_log2 (x - 1) + 1;
+}
+
+static inline int
exact_log2 (unsigned HOST_WIDE_INT x)
{
return x == (x & -x) && x ? ctz_hwi (x) : -1;