lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Luiz Henrique de Figueiredo wrote:
void luaU_header (char* h)
{
 int x=1;
 *h++=(char)*(char*)&x;				/* endianness */
}
A small point of interest. When working the Xbox 360, the above endianness didn't work using a local variable. Instead, I had to create a static global. :( This was under Lua 5.0, but I'm guessing it will still apply now.

static int x = 1;

int luaU_endianness (void)
{
/* int x=1; */
return *(char*)&x;
}

Take it for what it's worth.

Josh