diff options
author | Dimitris Papastamos <dimitris.papastamos@arm.com> | 2018-05-15 15:34:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-15 15:34:20 +0100 |
commit | a513506b0719a7321d755facb81f46e6272cfa90 (patch) | |
tree | b0dd91d996616d6150396aa6626c5d1556636574 /include/lib/utils_def.h | |
parent | 83cf7a006eead324f458fc961cb4bcc01b526c03 (diff) | |
parent | 0b9ce9064c9e27184ff1052d47c4fd0d9a07d521 (diff) |
Merge pull request #1373 from jeenu-arm/ras-support
RAS support
Diffstat (limited to 'include/lib/utils_def.h')
-rw-r--r-- | include/lib/utils_def.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/lib/utils_def.h b/include/lib/utils_def.h index 8abc73c0..31b12945 100644 --- a/include/lib/utils_def.h +++ b/include/lib/utils_def.h @@ -68,6 +68,13 @@ (((ptr) > UINTPTR_MAX - (inc)) ? 1 : 0) /* + * Evaluates to 1 if (u32 + inc) overflows, 0 otherwise. + * Both arguments must be 32-bit unsigned integers (i.e. effectively uint32_t). + */ +#define check_u32_overflow(u32, inc) \ + ((u32) > (UINT32_MAX - (inc)) ? 1 : 0) + +/* * For those constants to be shared between C and other sources, apply a 'u' * or 'ull' suffix to the argument only in C, to avoid undefined or unintended * behaviour. |