diff options
Diffstat (limited to 'git-compat-util.h')
-rw-r--r-- | git-compat-util.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h index bd93b6257..c08688c8f 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -13,6 +13,14 @@ #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) +#ifdef __GNUC__ +#define TYPEOF(x) (__typeof__(x)) +#else +#define TYPEOF(x) +#endif + +#define MSB(x, bits) ((x) & TYPEOF(x)(~0ULL << (sizeof(x) * 8 - (bits)))) + #if !defined(__APPLE__) && !defined(__FreeBSD__) #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */ #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */ |