lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo wrote:
Just to be clear, if the sizes of double and the endianness in both
platforms match, then this should work:

static lua_Number LoadNumber(LoadState* S)
{
 double x;
 LoadVar(S,x);
 return (lua_Number) x;
}

But you still need to change LoadHeader to skip some bytes:

 IF (memcmp(h,s,LUAC_HEADERSIZE-2)!=0, "bad header");

Thanks. That's interesting because I could use the same compiled files with patched (to use ints) and unpatched interpreters. I wonder how slow the double-->int conversion will be on a machine without fp coprocessor, but I'll find out.

  Enrico