Reimplement MDFN_WARN_UNUSED, MDFN_LIKELY, MDFN_UNLIKELY

This commit is contained in:
twinaphex 2013-03-02 08:39:58 +01:00
parent ebd65de110
commit 8196858fab

View File

@ -15,6 +15,8 @@ typedef uint32_t uint32;
typedef uint64_t uint64;
#ifdef __GNUC__
#define MDFN_LIKELY(n) __builtin_expect((n) != 0, 0)
#define MDFN_UNLIKELY(n) __builtin_expect((n) != 0, 1)
#define INLINE inline __attribute__((always_inline))
#define NO_INLINE __attribute__((noinline))
@ -28,11 +30,14 @@ typedef uint64_t uint64;
#define MDFN_ALIGN(n) __attribute__ ((aligned (n)))
#define MDFN_FORMATSTR(a,b,c) __attribute__ ((format (a, b, c)));
#define MDFN_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
#define MDFN_NOWARN_UNUSED __attribute__((unused))
#elif defined(_MSC_VER)
#define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f))
#define INLINE inline
#define NO_INLINE
#define MDFN_LIKELY(n) ((n) != 0)
#define MDFN_UNLIKELY(n) ((n) != 0)
#define MDFN_FASTCALL
@ -41,6 +46,7 @@ typedef uint64_t uint64;
#define MDFN_FORMATSTR(a,b,c)
#define MDFN_WARN_UNUSED_RESULT
#define MDFN_NOWARN_UNUSED
#else
#error "Not compiling with GCC nor MSVC"
@ -118,7 +124,5 @@ typedef unsigned char Boolean; /* 0 or 1 */
#include "error.h"
#define MDFN_LIKELY(n)
#define MDFN_UNLIKELY(n)
#endif