Skip to content

Commit 978901d

Browse files
committed
Updates
1 parent 234aba6 commit 978901d

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

include/retro_endianness.h

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -76,26 +76,23 @@
7676
#include <winsock2.h>
7777
#endif
7878

79-
#if defined (BYTE_ORDER) && defined (BIG_ENDIAN) && defined (LITTLE_ENDIAN)
80-
# if BYTE_ORDER == BIG_ENDIAN
81-
# define MSB_FIRST 1
82-
# elif BYTE_ORDER == LITTLE_ENDIAN
83-
# define LSB_FIRST 1
84-
# else
85-
# error "Invalid endianness macros"
86-
# endif
87-
#elif defined (__BYTE_ORDER__) && defined (__ORDER_BIG_ENDIAN__) && defined (__ORDER_LITTLE_ENDIAN__)
88-
# if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
89-
# define MSB_FIRST 1
90-
# elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
91-
# define LSB_FIRST 1
92-
# else
93-
# error "Invalid endianness macros"
94-
# endif
95-
#elif defined (__i386__) || defined(__x86_64__)
96-
# define LSB_FIRST 1
79+
#ifdef _MSC_VER
80+
#if _M_IX86 || _M_AMD64 || _M_ARM || _M_ARM64
81+
#define LSB_FIRST 1
82+
#elif _M_PPC
83+
#define MSB_FIRST 1
84+
#else
85+
/* MSVC can run on _M_ALPHA and _M_IA64 too, but they're both bi-endian; need to find what mode MSVC runs them at */
86+
#error "unknown platform, can't determine endianness"
87+
#endif
9788
#else
98-
# error "Unknown platform"
89+
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
90+
#define MSB_FIRST 1
91+
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
92+
#define LSB_FIRST 1
93+
#else
94+
#error "Invalid endianness macros"
95+
#endif
9996
#endif
10097

10198
#if defined(MSB_FIRST) && defined(LSB_FIRST)

0 commit comments

Comments
 (0)