commit x64 compilation from lulu cause the other branch dont seems to compile properly at home

This commit is contained in:
2026-07-17 16:08:20 +02:00
parent c0f3eeb00d
commit 0efa4ee6f7
625 changed files with 117283 additions and 4426 deletions

View File

@ -0,0 +1,63 @@
/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#include "memory/endian.h"
#include "platform_config.h"
#include "log/log.h"
namespace GS {
namespace Endian {
static Config g_host_endian = Undefined;
//------------------------------------------------------------------------------
void SwapBytes(void *in_p, size_t n)
{
if (n == 1)
return;
__ASSERT__(!(n & 1));
char *p = (char *)in_p;
for (size_t c = 0; c < n / 2; ++c)
{
char tmp = p[c];
p[c] = p[n - c - 1];
p[n - c - 1] = tmp;
}
}
Config GetHostConfiguration()
{
if (g_host_endian == Undefined)
{
union
{
uint i;
char c[4];
} bint = { 0x01020304 };
g_host_endian = bint.c[0] == 1 ? Big : Little;
if (g_host_endian == Big)
__LOG__ << "Memory configuration: Big endian.\n";
else __LOG__ << "Memory configuration: Little endian.\n";
}
return g_host_endian;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void *ToHost(void *p, size_t size, Config source_endian)
{
if (GetHostConfiguration() != source_endian)
SwapBytes(p, size);
return p;
}
//------------------------------------------------------------------------------
}
}