Changeset View
Changeset View
Standalone View
Standalone View
source/lib/byte_order.h
/* Copyright (C) 2015 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | ||||
* | * | ||||
* Permission is hereby granted, free of charge, to any person obtaining | * Permission is hereby granted, free of charge, to any person obtaining | ||||
* a copy of this software and associated documentation files (the | * a copy of this software and associated documentation files (the | ||||
* "Software"), to deal in the Software without restriction, including | * "Software"), to deal in the Software without restriction, including | ||||
* without limitation the rights to use, copy, modify, merge, publish, | * without limitation the rights to use, copy, modify, merge, publish, | ||||
* distribute, sublicense, and/or sell copies of the Software, and to | * distribute, sublicense, and/or sell copies of the Software, and to | ||||
* permit persons to whom the Software is furnished to do so, subject to | * permit persons to whom the Software is furnished to do so, subject to | ||||
* the following conditions: | * the following conditions: | ||||
Show All 18 Lines | |||||
#define INCLUDED_BYTE_ORDER | #define INCLUDED_BYTE_ORDER | ||||
#include "lib/sysdep/cpu.h" | #include "lib/sysdep/cpu.h" | ||||
// detect byte order via predefined macros. | // detect byte order via predefined macros. | ||||
#ifndef BYTE_ORDER | #ifndef BYTE_ORDER | ||||
# define LITTLE_ENDIAN 0x4321 | # define LITTLE_ENDIAN 0x4321 | ||||
# define BIG_ENDIAN 0x1234 | # define BIG_ENDIAN 0x1234 | ||||
# if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || defined(__LITTLE_ENDIAN__) | # if ARCH_IA32 || ARCH_IA64 || ARCH_AMD64 || ARCH_ALPHA || ARCH_ARM || ARCH_AARCH64 || ARCH_MIPS || ARCH_E2K || defined(__LITTLE_ENDIAN__) | ||||
# define BYTE_ORDER LITTLE_ENDIAN | # define BYTE_ORDER LITTLE_ENDIAN | ||||
# else | # else | ||||
# define BYTE_ORDER BIG_ENDIAN | # define BYTE_ORDER BIG_ENDIAN | ||||
# endif | # endif | ||||
#endif | #endif | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 122 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator