summaryrefslogtreecommitdiff
path: root/gcc/double-int.h
diff options
context:
space:
mode:
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-17 12:48:36 +0000
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>2012-07-17 12:48:36 +0000
commit45105ae28dcce494eb1ab6a02f1e1f24b82e2ec7 (patch)
tree95b0113f480da4289ca38b07f1d29157bae7e038 /gcc/double-int.h
parent087dde2d35142ee19a522164cf3267ef73fb71c7 (diff)
downloadgcc-45105ae28dcce494eb1ab6a02f1e1f24b82e2ec7.tar.gz
2012-07-17 Tom de Vries <tom@codesourcery.com>
* double-int.h (double_int_popcount): New inline function. * hwint.c (popcount_hwi): New function. * hwint.h (popcount_hwi): Declare function. New inline function. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@189575 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/double-int.h')
-rw-r--r--gcc/double-int.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/double-int.h b/gcc/double-int.h
index 50a9bda5d6a..eab9c3c14a6 100644
--- a/gcc/double-int.h
+++ b/gcc/double-int.h
@@ -284,6 +284,14 @@ double_int_equal_p (double_int cst1, double_int cst2)
return cst1.low == cst2.low && cst1.high == cst2.high;
}
+/* Return number of set bits of CST. */
+
+static inline int
+double_int_popcount (double_int cst)
+{
+ return popcount_hwi (cst.high) + popcount_hwi (cst.low);
+}
+
/* Legacy interface with decomposed high/low parts. */