diff options
author | Richard Sandiford <rdsandiford@googlemail.com> | 2013-11-18 14:51:45 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2013-11-18 14:51:45 +0000 |
commit | 7c5efc1206d99472b0a1615b9da8f31cd849014b (patch) | |
tree | ea1865acfa2c48b11b47c74919bbc11f420abb9a /gcc/tree.c | |
parent | 5a36c51b09466ab6c403be328a970aa65e47bc90 (diff) | |
download | gcc-7c5efc1206d99472b0a1615b9da8f31cd849014b.zip gcc-7c5efc1206d99472b0a1615b9da8f31cd849014b.tar.gz gcc-7c5efc1206d99472b0a1615b9da8f31cd849014b.tar.bz2 |
tree.h (tree_to_shwi, [...]): Declare, with inline expansions.
gcc/
* tree.h (tree_to_shwi, tree_to_uhwi): Declare, with inline expansions.
* tree.c (tree_to_shwi, tree_to_uhwi): New functions.
From-SVN: r204958
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -7027,6 +7027,28 @@ tree_low_cst (const_tree t, int pos) return TREE_INT_CST_LOW (t); } +/* T is an INTEGER_CST whose numerical value (extended according to + TYPE_UNSIGNED) fits in a signed HOST_WIDE_INT. Return that + HOST_WIDE_INT. */ + +HOST_WIDE_INT +tree_to_shwi (const_tree t) +{ + gcc_assert (tree_fits_shwi_p (t)); + return TREE_INT_CST_LOW (t); +} + +/* T is an INTEGER_CST whose numerical value (extended according to + TYPE_UNSIGNED) fits in an unsigned HOST_WIDE_INT. Return that + HOST_WIDE_INT. */ + +HOST_WIDE_INT +tree_to_uhwi (const_tree t) +{ + gcc_assert (tree_fits_uhwi_p (t)); + return TREE_INT_CST_LOW (t); +} + /* Return the most significant (sign) bit of T. */ int |