gpu_neon: rework buffer selection
[pcsx_rearmed.git] / include / compiler_features.h
CommitLineData
dec3c1d7 1
2#ifdef __GNUC__
3# define likely(x) __builtin_expect((x),1)
4# define unlikely(x) __builtin_expect((x),0)
f2e25348 5# ifdef __clang__
6# define noinline __attribute__((noinline))
7# else
8# define noinline __attribute__((noinline,noclone))
9# endif
10# define unused __attribute__((unused))
dec3c1d7 11#else
12# define likely(x) (x)
13# define unlikely(x) (x)
6d79a06f 14# define noinline
f2e25348 15# define unused
dec3c1d7 16#endif
17
18#ifndef __has_builtin
19#define __has_builtin(x) 0
20#endif
21
f2e25348 22#if __has_builtin(__builtin_add_overflow) || (defined(__GNUC__) && __GNUC__ >= 5)
23#define add_overflow(a, b, r) __builtin_add_overflow(a, b, &(r))
24#define sub_overflow(a, b, r) __builtin_sub_overflow(a, b, &(r))
25#else
26#define add_overflow(a, b, r) ({r = (u32)a + (u32)b; (a ^ ~b) & (a ^ r) & (1u<<31);})
27#define sub_overflow(a, b, r) ({r = (u32)a - (u32)b; (a ^ b) & (a ^ r) & (1u<<31);})
28#endif
29