Big-endian support (#909)

This commit is contained in:
GaryOderNichts 2022-07-27 23:50:56 +02:00 committed by GitHub
commit 6818247317
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 762 additions and 62 deletions

View file

@ -5,6 +5,28 @@
#include <vector>
#include <cstring>
#ifdef _MSC_VER
#define BSWAP16 _byteswap_ushort
#define BSWAP32 _byteswap_ulong
#define BSWAP64 _byteswap_uint64
#else
#define BSWAP16 __builtin_bswap16
#define BSWAP32 __builtin_bswap32
#define BSWAP64 __builtin_bswap64
#endif
enum class Endianness
{
Little = 0,
Big = 1,
#if (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) || defined(__BIG_ENDIAN__)
Native = Big,
#else
Native = Little,
#endif
};
class BitConverter
{
public: