aboutsummaryrefslogtreecommitdiff
path: root/gcc/system.h
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2001-10-21 19:44:08 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2001-10-21 19:44:08 +0000
commit5297e08564adcb6d396d0870df9c1df1d2c6aab9 (patch)
tree50a7ccac927ff3fce5b7e2bad6d5a896b3c10f83 /gcc/system.h
parent77c068446e143cc8f95e276eadee7528f3142105 (diff)
downloadgcc-5297e08564adcb6d396d0870df9c1df1d2c6aab9.zip
gcc-5297e08564adcb6d396d0870df9c1df1d2c6aab9.tar.gz
gcc-5297e08564adcb6d396d0870df9c1df1d2c6aab9.tar.bz2
arm.h (FUNCTION_ARG_REGNO_P): Use IN_RANGE.
* arm.h (FUNCTION_ARG_REGNO_P): Use IN_RANGE. * system.h (IN_RANGE): New macro. From-SVN: r46395
Diffstat (limited to 'gcc/system.h')
-rw-r--r--gcc/system.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/system.h b/gcc/system.h
index 55a9370..7cf3b5f 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -168,6 +168,16 @@ extern int errno;
/* Get definitions of HOST_WIDE_INT and HOST_WIDEST_INT. */
#include "hwint.h"
+/* A macro to determine whether a VALUE lies inclusively within a
+ certain range without evaluating the VALUE more than once. This
+ macro won't warn if the VALUE is unsigned and the LOWER bound is
+ zero, as it would e.g. with "VALUE >= 0 && ...". Note the LOWER
+ bound *is* evaluated twice, and LOWER must not be greater than
+ UPPER. However the bounds themselves can be either positive or
+ negative. */
+#define IN_RANGE(VALUE, LOWER, UPPER) \
+ ((unsigned HOST_WIDE_INT)((VALUE) - (LOWER)) <= ((UPPER) - (LOWER)))
+
/* Infrastructure for defining missing _MAX and _MIN macros. Note that
macros defined with these cannot be used in #if. */