diff options
author | PikalaxALT <PikalaxALT@users.noreply.github.com> | 2019-07-20 12:11:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-20 12:11:46 -0400 |
commit | 4d5c1ca03b4e7db3c44c71afaa01b1549a282a19 (patch) | |
tree | ec2e9ec5f3e4a6d8523e80ab58e6c9c296fbc05c /include/global.h | |
parent | 3f762629e830c0cad66c4efeea5b918bdf4cce20 (diff) | |
parent | 6edacdee36d31b2df69559f28a33b8d9e958bf5e (diff) |
Merge pull request #732 from PikalaxALT/modern_gcc
Modernize code for compatibility with later releases of GCC
Diffstat (limited to 'include/global.h')
-rw-r--r-- | include/global.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/global.h b/include/global.h index 969680dd7..a76d6e4e3 100644 --- a/include/global.h +++ b/include/global.h @@ -2,6 +2,7 @@ #define GUARD_GLOBAL_H #include <string.h> +#include <limits.h> #include "config.h" // we need to define config before gba headers as print stuff needs the functions nulled before defines. #include "gba/gba.h" #include "constants/global.h" @@ -62,6 +63,10 @@ #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) >= (b) ? (a) : (b)) +#if MODERN +#define abs(x) (((x) < 0) ? -(x) : (x)) +#endif + // Extracts the upper 16 bits of a 32-bit number #define HIHALF(n) (((n) & 0xFFFF0000) >> 16) |