summaryrefslogtreecommitdiffstats
path: root/gcc/system.h
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-21 19:44:08 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2001-10-21 19:44:08 +0000
commitaf32b0503e3da9788e8a904dc44b590514b5fd28 (patch)
tree50a7ccac927ff3fce5b7e2bad6d5a896b3c10f83 /gcc/system.h
parentc6c8127de09a50c59d9004f83d55321888be8b77 (diff)
downloadppe42-gcc-af32b0503e3da9788e8a904dc44b590514b5fd28.tar.gz
ppe42-gcc-af32b0503e3da9788e8a904dc44b590514b5fd28.zip
* arm.h (FUNCTION_ARG_REGNO_P): Use IN_RANGE.
* system.h (IN_RANGE): New macro. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46395 138bc75d-0d04-0410-961f-82ee72b054a4
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 55a9370aca4..7cf3b5fe8bf 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. */
OpenPOWER on IntegriCloud