|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
-** $Id: llimits.h,v 1.103 2013/02/20 14:08:56 roberto Exp roberto $
|
|
|
+** $Id: llimits.h,v 1.104 2013/04/25 21:15:37 roberto Exp roberto $
|
|
|
** Limits, basic types, and some other `installation-dependent' definitions
|
|
|
** See Copyright Notice in lua.h
|
|
|
*/
|
|
@@ -202,52 +202,6 @@ typedef lu_int32 Instruction;
|
|
|
** both small and large values (outside the range of integers).
|
|
|
*/
|
|
|
|
|
|
-#if defined(MS_ASMTRICK) || defined(LUA_MSASMTRICK) /* { */
|
|
|
-/* trick with Microsoft assembler for X86 */
|
|
|
-
|
|
|
-#define lua_number2int(i,n) __asm {__asm fld n __asm fistp i}
|
|
|
-#define lua_number2integer(i,n) lua_number2int(i, n)
|
|
|
-#define lua_number2unsigned(i,n) \
|
|
|
- {__int64 l; __asm {__asm fld n __asm fistp l} i = (unsigned int)l;}
|
|
|
-
|
|
|
-
|
|
|
-#elif defined(LUA_IEEE754TRICK) /* }{ */
|
|
|
-/* the next trick should work on any machine using IEEE754 with
|
|
|
- a 32-bit int type */
|
|
|
-
|
|
|
-union luai_Cast { double l_d; LUA_INT32 l_p[2]; };
|
|
|
-
|
|
|
-#if !defined(LUA_IEEEENDIAN) /* { */
|
|
|
-#define LUAI_EXTRAIEEE \
|
|
|
- static const union luai_Cast ieeeendian = {-(33.0 + 6755399441055744.0)};
|
|
|
-#define LUA_IEEEENDIANLOC (ieeeendian.l_p[1] == 33)
|
|
|
-#else
|
|
|
-#define LUA_IEEEENDIANLOC LUA_IEEEENDIAN
|
|
|
-#define LUAI_EXTRAIEEE /* empty */
|
|
|
-#endif /* } */
|
|
|
-
|
|
|
-#define lua_number2int32(i,n,t) \
|
|
|
- { LUAI_EXTRAIEEE \
|
|
|
- volatile union luai_Cast u; u.l_d = (n) + 6755399441055744.0; \
|
|
|
- (i) = (t)u.l_p[LUA_IEEEENDIANLOC]; }
|
|
|
-
|
|
|
-#define luai_hashnum(i,n) \
|
|
|
- { volatile union luai_Cast u; u.l_d = (n) + 1.0; /* avoid -0 */ \
|
|
|
- (i) = u.l_p[0]; (i) += u.l_p[1]; } /* add double bits for his hash */
|
|
|
-
|
|
|
-#define lua_number2int(i,n) lua_number2int32(i, n, int)
|
|
|
-#define lua_number2unsigned(i,n) lua_number2int32(i, n, lua_Unsigned)
|
|
|
-
|
|
|
-/* the trick can be expanded to lua_Integer when it is a 32-bit value */
|
|
|
-#if defined(LUA_IEEELL)
|
|
|
-#define lua_number2integer(i,n) lua_number2int32(i, n, lua_Integer)
|
|
|
-#endif
|
|
|
-
|
|
|
-#endif /* } */
|
|
|
-
|
|
|
-
|
|
|
-/* the following definitions always work, but may be slow */
|
|
|
-
|
|
|
#if !defined(lua_number2int)
|
|
|
#define lua_number2int(i,n) ((i)=(int)(n))
|
|
|
#endif
|
|
@@ -269,15 +223,6 @@ union luai_Cast { double l_d; LUA_INT32 l_p[2]; };
|
|
|
#endif /* } */
|
|
|
|
|
|
|
|
|
-#if !defined(lua_unsigned2number)
|
|
|
-/* on several machines, coercion from unsigned to double is slow,
|
|
|
- so it may be worth to avoid */
|
|
|
-#define lua_unsigned2number(u) \
|
|
|
- (((u) <= (lua_Unsigned)INT_MAX) ? (lua_Number)(int)(u) : (lua_Number)(u))
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
#if defined(ltable_c) && !defined(luai_hashnum)
|
|
|
|
|
|
#include <float.h>
|