aboutsummaryrefslogtreecommitdiff
path: root/gcc/double-int.h
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2012-07-17 12:48:36 +0000
committerTom de Vries <vries@gcc.gnu.org>2012-07-17 12:48:36 +0000
commit440b6d590a8565358b3d603e27af8bd7db3fa27a (patch)
tree95b0113f480da4289ca38b07f1d29157bae7e038 /gcc/double-int.h
parenta86ec59783d1630f46d758b27faf5c5fe061ecfe (diff)
downloadgcc-440b6d590a8565358b3d603e27af8bd7db3fa27a.zip
gcc-440b6d590a8565358b3d603e27af8bd7db3fa27a.tar.gz
gcc-440b6d590a8565358b3d603e27af8bd7db3fa27a.tar.bz2
double-int.h (double_int_popcount): New inline function.
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. From-SVN: r189575
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 50a9bda..eab9c3c 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. */