aboutsummaryrefslogtreecommitdiff
path: root/gcc/double-int.h
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2010-04-15 02:05:32 +0400
committerAnatoly Sokolov <aesok@gcc.gnu.org>2010-04-15 02:05:32 +0400
commit2bd1333d629dababe7b7d18c46d59c0489929e8b (patch)
tree9138061992a73bba986379151a1a1c756a746bf2 /gcc/double-int.h
parent8b9b8e930562b7cf5598dc5b564fa71d989ebb3c (diff)
downloadgcc-2bd1333d629dababe7b7d18c46d59c0489929e8b.zip
gcc-2bd1333d629dababe7b7d18c46d59c0489929e8b.tar.gz
gcc-2bd1333d629dababe7b7d18c46d59c0489929e8b.tar.bz2
double-int.h (HOST_BITS_PER_DOUBLE_INT): Define.
* double-int.h (HOST_BITS_PER_DOUBLE_INT): Define. (double_int_not, double_int_lshift, double_int_rshift): Declare. (double_int_negative_p): Convert to static inline function. * double-int.c (double_int_lshift, double_int_lshift): Add new function. (double_int_negative_p): Remove. * tree.h (lshift_double, rshift_double): * tree.c (build_low_bits_mask): Clean up, use double_int_* functions. * fold-const.c (fold_convert_const_int_from_real, fold_convert_const_int_from_fixed, div_if_zero_remainder): (Ditto.). (lshift_double): Change type of arith argument to bool. (rshift_double): Change type of arith argument to bool. Correct comment. * expmed.c (mask_rtx, lshift_value): (Ditto.). From-SVN: r158360
Diffstat (limited to 'gcc/double-int.h')
-rw-r--r--gcc/double-int.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/gcc/double-int.h b/gcc/double-int.h
index 8418589..30e32fc 100644
--- a/gcc/double-int.h
+++ b/gcc/double-int.h
@@ -1,5 +1,5 @@
/* Operations with long integers.
- Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
This file is part of GCC.
@@ -57,6 +57,8 @@ typedef struct
HOST_WIDE_INT high;
} double_int;
+#define HOST_BITS_PER_DOUBLE_INT (2 * HOST_BITS_PER_WIDE_INT)
+
union tree_node;
/* Constructors and conversions. */
@@ -127,7 +129,29 @@ double_int double_int_umod (double_int, double_int, unsigned);
double_int double_int_divmod (double_int, double_int, bool, unsigned, double_int *);
double_int double_int_sdivmod (double_int, double_int, unsigned, double_int *);
double_int double_int_udivmod (double_int, double_int, unsigned, double_int *);
-bool double_int_negative_p (double_int);
+
+/* Logical operations. */
+static inline double_int
+double_int_not (double_int a)
+{
+ a.low = ~a.low;
+ a.high = ~ a.high;
+ return a;
+}
+
+/* Shift operations. */
+double_int double_int_lshift (double_int, HOST_WIDE_INT, unsigned int, bool);
+double_int double_int_rshift (double_int, HOST_WIDE_INT, unsigned int, bool);
+
+/* Returns true if CST is negative. Of course, CST is considered to
+ be signed. */
+
+static inline bool
+double_int_negative_p (double_int cst)
+{
+ return cst.high < 0;
+}
+
int double_int_cmp (double_int, double_int, bool);
int double_int_scmp (double_int, double_int);
int double_int_ucmp (double_int, double_int);