summaryrefslogtreecommitdiff
path: root/include/lib/utils.h
diff options
context:
space:
mode:
authordavidcunado-arm <david.cunado@arm.com>2017-04-06 10:20:47 +0100
committerGitHub <noreply@github.com>2017-04-06 10:20:47 +0100
commited7562521b8b68e6e3d681c9564cd69afbf93e89 (patch)
treef15bdf21a1fb1144367a0a9ba5172e0fc141ea4c /include/lib/utils.h
parent90e0ffd367c0e06bf42b323e78d7f4e455419a9e (diff)
parente6d2aea159f4b88fc128ae62432c8fff4b0c2e5f (diff)
Merge pull request #886 from dp-arm/dp/stack-protector
Add support for GCC stack protection
Diffstat (limited to 'include/lib/utils.h')
-rw-r--r--include/lib/utils.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/lib/utils.h b/include/lib/utils.h
index 69bbb430..279c9135 100644
--- a/include/lib/utils.h
+++ b/include/lib/utils.h
@@ -42,6 +42,20 @@
#define BIT(nr) (1UL << (nr))
+#define MIN(x, y) __extension__ ({ \
+ __typeof__(x) _x = (x); \
+ __typeof__(y) _y = (y); \
+ (void)(&_x == &_y); \
+ _x < _y ? _x : _y; \
+})
+
+#define MAX(x, y) __extension__ ({ \
+ __typeof__(x) _x = (x); \
+ __typeof__(y) _y = (y); \
+ (void)(&_x == &_y); \
+ _x > _y ? _x : _y; \
+})
+
/*
* The round_up() macro rounds up a value to the given boundary in a
* type-agnostic yet type-safe manner. The boundary must be a power of two.