From e6693cfa844724b9638ba35ebadc295eb8ef1b3c Mon Sep 17 00:00:00 2001 From: Anatoly Sokolov Date: Mon, 3 May 2010 20:21:15 +0400 Subject: double-int.h (tree_to_double_int): Remove macro. * double-int.h (tree_to_double_int): Remove macro. (double_int_to_tree, double_int_fits_to_tree_p): Move prototypes ... * tree.h (double_int_to_tree, double_int_fits_to_tree_p): ... here. (tree_to_double_int): New function. * double-int.c (double_int_to_tree, double_int_fits_to_tree_p): Move ... * tree.c (double_int_to_tree, double_int_fits_to_tree_p): ... here. From-SVN: r158993 --- gcc/tree.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'gcc/tree.c') diff --git a/gcc/tree.c b/gcc/tree.c index 24482af..b8f80de 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1082,6 +1082,30 @@ build_int_cst_wide_type (tree type, return build_int_cst_wide (type, low, high); } +/* 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. */ + +tree +double_int_to_tree (tree type, double_int cst) +{ + cst = double_int_ext (cst, TYPE_PRECISION (type), TYPE_UNSIGNED (type)); + + return build_int_cst_wide (type, cst.low, cst.high); +} + +/* Returns true if CST fits into range of TYPE. Signedness of CST is assumed + to be the same as the signedness of TYPE. */ + +bool +double_int_fits_to_tree_p (const_tree type, double_int cst) +{ + double_int ext = double_int_ext (cst, + TYPE_PRECISION (type), + TYPE_UNSIGNED (type)); + + return double_int_equal_p (cst, ext); +} + /* These are the hash table functions for the hash table of INTEGER_CST nodes of a sizetype. */ -- cgit v1.1