lua-users home
lua-l archive

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




2010/1/9 Mike Pall <mikelu-1001@mike.de>


#if defined(LUA_NUMBER_DOUBLE) && ... defined(__i386__) ...
...
union luai_Cast { double l_d; long l_l; };
#define lua_number2int(i,d) \
 { volatile union luai_Cast u; u.l_d = (d) + 6755399441055744.0; (i) = u.l_l; }
...
#define lua_number2uint(i,n)            lua_number2int(i, n)
...


--Mike
There was a thread in which I comment on this type of usage with a union yesterday quoting the C standard that it is undefined behavior, it was even followed by a post from Roberto who stated that [because it is undefined] is why Lua does not use it ?