diff options
author | Anatoly Sokolov <aesok@post.ru> | 2010-04-15 02:05:32 +0400 |
---|---|---|
committer | Anatoly Sokolov <aesok@gcc.gnu.org> | 2010-04-15 02:05:32 +0400 |
commit | 2bd1333d629dababe7b7d18c46d59c0489929e8b (patch) | |
tree | 9138061992a73bba986379151a1a1c756a746bf2 /gcc/double-int.c | |
parent | 8b9b8e930562b7cf5598dc5b564fa71d989ebb3c (diff) | |
download | gcc-2bd1333d629dababe7b7d18c46d59c0489929e8b.tar.gz |
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.c')
-rw-r--r-- | gcc/double-int.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/gcc/double-int.c b/gcc/double-int.c index a49ce473a7e..1a746814598 100644 --- a/gcc/double-int.c +++ b/gcc/double-int.c @@ -1,5 +1,5 @@ /* Operations with long integers. - Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -290,6 +290,30 @@ double_int_umod (double_int a, double_int b, unsigned code) return double_int_mod (a, b, true, code); } +/* Shift A left by COUNT places keeping only PREC bits of result. Shift + right if COUNT is negative. ARITH true specifies arithmetic shifting; + otherwise use logical shift. */ + +double_int +double_int_lshift (double_int a, HOST_WIDE_INT count, unsigned int prec, bool arith) +{ + double_int ret; + lshift_double (a.low, a.high, count, prec, &ret.low, &ret.high, arith); + return ret; +} + +/* Shift A rigth by COUNT places keeping only PREC bits of result. Shift + left if COUNT is negative. ARITH true specifies arithmetic shifting; + otherwise use logical shift. */ + +double_int +double_int_rshift (double_int a, HOST_WIDE_INT count, unsigned int prec, bool arith) +{ + double_int ret; + rshift_double (a.low, a.high, count, prec, &ret.low, &ret.high, arith); + return ret; +} + /* Constructs tree in type TYPE from with value given by CST. Signedness of CST is assumed to be the same as the signedness of TYPE. */ @@ -314,15 +338,6 @@ double_int_fits_to_tree_p (const_tree type, double_int cst) return double_int_equal_p (cst, ext); } -/* Returns true if CST is negative. Of course, CST is considered to - be signed. */ - -bool -double_int_negative_p (double_int cst) -{ - return cst.high < 0; -} - /* Returns -1 if A < B, 0 if A == B and 1 if A > B. Signedness of the comparison is given by UNS. */ |