beetle-pce-fast-libretro/mednafen/mednafen-types.h

113 lines
2.1 KiB
C
Raw Normal View History

2012-06-03 15:48:14 +00:00
#ifndef __MDFN_TYPES
#define __MDFN_TYPES
2013-03-01 18:06:52 +00:00
#include <stdint.h>
2016-08-14 02:43:15 +00:00
#include <retro_inline.h>
2012-06-03 15:48:14 +00:00
typedef int8_t int8;
typedef int16_t int16;
2013-03-01 18:06:52 +00:00
typedef int32_t int32;
2012-06-03 15:48:14 +00:00
typedef int64_t int64;
2013-03-01 18:06:52 +00:00
typedef uint8_t uint8;
2012-06-03 15:48:14 +00:00
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;
#ifdef __GNUC__
#define MDFN_UNLIKELY(n) __builtin_expect((n) != 0, 0)
#define MDFN_LIKELY(n) __builtin_expect((n) != 0, 1)
2012-06-03 15:48:14 +00:00
#define NO_INLINE __attribute__((noinline))
#if defined(__386__) || defined(__i386__) || defined(__i386) || defined(_M_IX86) || defined(_M_I386)
#define MDFN_FASTCALL __attribute__((fastcall))
#else
#define MDFN_FASTCALL
#endif
#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))
2012-06-03 15:48:14 +00:00
#elif defined(_MSC_VER)
2017-08-04 03:57:00 +00:00
#if _MSC_VER < 1800
2013-03-01 18:06:52 +00:00
#define roundf(in) (in >= 0.0f ? floorf(in + 0.5f) : ceilf(in - 0.5f))
2017-08-04 03:57:00 +00:00
#endif
#define NO_INLINE
#define MDFN_LIKELY(n) ((n) != 0)
#define MDFN_UNLIKELY(n) ((n) != 0)
2012-06-03 15:48:14 +00:00
2013-03-01 18:06:52 +00:00
#define MDFN_FASTCALL
2012-06-03 15:48:14 +00:00
#define MDFN_ALIGN(n) __declspec(align(n))
#define MDFN_FORMATSTR(a,b,c)
#define MDFN_WARN_UNUSED_RESULT
#define MDFN_NOWARN_UNUSED
2012-06-03 15:48:14 +00:00
#else
#error "Not compiling with GCC nor MSVC"
#define NO_INLINE
#define MDFN_FASTCALL
#define MDFN_ALIGN(n) // hence the #error.
#define MDFN_FORMATSTR(a,b,c)
#define MDFN_WARN_UNUSED_RESULT
#endif
typedef struct
{
union
{
struct
{
#ifdef MSB_FIRST
uint8 High;
uint8 Low;
#else
uint8 Low;
uint8 High;
#endif
} Union8;
uint16 Val16;
};
} Uuint16;
typedef struct
{
union
{
struct
{
#ifdef MSB_FIRST
Uuint16 High;
Uuint16 Low;
#else
Uuint16 Low;
Uuint16 High;
#endif
} Union16;
uint32 Val32;
};
} Uuint32;
typedef uint32 UTF32; /* at least 32 bits */
typedef uint16 UTF16; /* at least 16 bits */
typedef uint8 UTF8; /* typically 8 bits */
typedef unsigned char Boolean; /* 0 or 1 */
2013-03-01 18:06:52 +00:00
#define MDFN_COLD
2012-06-03 15:48:14 +00:00
#undef require
#define require( expr ) assert( expr )
#endif