[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bytecode converter
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 26 Oct 2007 18:11:15 -0200
> Just out of curiosity, how complex would it be to write a converter from
> compiled bytecode where LUA_NUMBER is double to compiled bytecode where
> LUA_NUMBER is int?
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");