lua-users home
lua-l archive

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


> On MSVC compiler this construction
> 
> #define lua_number2int(i,n)  __asm {__asm fld n   __asm fistp i}
> 
> Example:
> 
> bit.band(0xFF000000, 0x00FFFFFF)
> 
> while debug after getting from stack, the first value is 0x80000000, second
> 0xFFFFFF

For the bit library lbitlib.c, the relevant macro is lua_uint2number,
which is called at getuintarg:

#define lua_number2uint(i,n)  \
  {__int64 l; __asm {__asm fld n   __asm fistp l} i = (unsigned int)l;}

You may want to add this line just before returning from getuintarg if
you want to debug it further:

printf("getuintarg: x=%f\tr=%ul %0x\n",x,r,r);