mirror of https://github.com/libAthena/athena.git
compile-time system endian check
This commit is contained in:
parent
7ef451c86a
commit
7ec5a5971a
|
@ -13,7 +13,7 @@ namespace Athena
|
||||||
namespace utility
|
namespace utility
|
||||||
{
|
{
|
||||||
inline bool isEmpty(atInt8* buf, atUint32 size) {return !memcmp(buf, buf + 1, size - 1);}
|
inline bool isEmpty(atInt8* buf, atUint32 size) {return !memcmp(buf, buf + 1, size - 1);}
|
||||||
bool isSystemBigEndian();
|
inline bool isSystemBigEndian() {return (*(atUint16*)"\xFE\xFF" == 0xFEFF);}
|
||||||
|
|
||||||
inline atInt16 swap16(atInt16 val)
|
inline atInt16 swap16(atInt16 val)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,12 +23,6 @@ namespace Athena
|
||||||
namespace utility
|
namespace utility
|
||||||
{
|
{
|
||||||
|
|
||||||
bool isSystemBigEndian()
|
|
||||||
{
|
|
||||||
static const atUint8* test = (atUint8*)"\xFE\xFF";
|
|
||||||
return (*(atUint16*)test == 0xFEFF);
|
|
||||||
}
|
|
||||||
|
|
||||||
void fillRandom(atUint8* rndArea, atUint64 count)
|
void fillRandom(atUint8* rndArea, atUint64 count)
|
||||||
{
|
{
|
||||||
for (atUint64 i = 0; i < count; i++)
|
for (atUint64 i = 0; i < count; i++)
|
||||||
|
|
Loading…
Reference in New Issue