diff --git a/contrib/lua/src/lstrlib.c b/contrib/lua/src/lstrlib.c --- a/contrib/lua/src/lstrlib.c +++ b/contrib/lua/src/lstrlib.c @@ -1121,7 +1121,7 @@ } -#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 +#ifndef LUA_AVOID_FLOAT /* ** Serialize a floating-point number in such a way that it can be ** scanned back by Lua. Use hexadecimal format for "common" numbers @@ -1163,7 +1163,7 @@ case LUA_TNUMBER: { char *buff = luaL_prepbuffsize(b, MAX_ITEM); int nb; -#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 +#ifndef LUA_AVOID_FLOAT if (!lua_isinteger(L, arg)) /* float? */ nb = quotefloat(L, buff, lua_tonumber(L, arg)); else { /* integers */ @@ -1264,7 +1264,7 @@ nb = lua_number2strx(L, buff, maxitem, form, luaL_checknumber(L, arg)); break; -#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 +#ifndef LUA_AVOID_FLOAT case 'f': maxitem = MAX_ITEMF; /* extra space for '%f' */ buff = luaL_prepbuffsize(&b, maxitem); @@ -1360,7 +1360,7 @@ struct cD { char c; union { -#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 +#ifndef LUA_AVOID_FLOAT double d; #endif void *p; lua_Integer i; lua_Number n; } u; @@ -1373,7 +1373,7 @@ ** Union for serializing floats */ typedef union Ftypes { -#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 +#ifndef LUA_AVOID_FLOAT float f; double d; #endif @@ -1465,7 +1465,7 @@ case 'j': *size = sizeof(lua_Integer); return Kint; case 'J': *size = sizeof(lua_Integer); return Kuint; case 'T': *size = sizeof(size_t); return Kuint; -#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 +#ifndef LUA_AVOID_FLOAT case 'f': *size = sizeof(float); return Kfloat; case 'd': *size = sizeof(double); return Kfloat; #endif @@ -1599,7 +1599,7 @@ Ftypes u; char *buff = luaL_prepbuffsize(&b, size); lua_Number n = luaL_checknumber(L, arg); /* get argument */ -#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 +#ifndef LUA_AVOID_FLOAT if (size == sizeof(u.f)) u.f = (float)n; /* copy it into 'u' */ else if (size == sizeof(u.d)) u.d = (double)n; else u.n = n; @@ -1736,7 +1736,7 @@ Ftypes u; lua_Number num; copywithendian((char *)&u, data + pos, size, h.islittle); -#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64 +#ifndef LUA_AVOID_FLOAT if (size == sizeof(u.f)) num = (lua_Number)u.f; else if (size == sizeof(u.d)) num = (lua_Number)u.d; else num = u.n; diff --git a/contrib/lua/src/lvm.c b/contrib/lua/src/lvm.c --- a/contrib/lua/src/lvm.c +++ b/contrib/lua/src/lvm.c @@ -53,7 +53,7 @@ ** 'l_intfitsf' checks whether a given integer is in the range that ** can be converted to a float without rounding. Used in comparisons. */ -#if !defined(l_intfitsf) && LUA_FLOAT_TYPE != LUA_FLOAT_INT64 +#if !defined(l_intfitsf) && !defined(LUA_AVOID_FLOAT) /* number of bits in the mantissa of a float */ #define NBM (l_floatatt(MANT_DIG)) @@ -80,7 +80,7 @@ #endif -#endif /* !defined(l_intfitsf) && LUA_FLOAT_TYPE != LUA_FLOAT_INT64 */ +#endif /* !defined(l_intfitsf) && !defined LUA_AVOID_FLOAT */ #ifndef l_intfitsf #define l_intfitsf(i) 1 diff --git a/stand/liblua/luaconf.local.h b/stand/liblua/luaconf.local.h --- a/stand/liblua/luaconf.local.h +++ b/stand/liblua/luaconf.local.h @@ -69,3 +69,5 @@ /* Maxalign can't reference double */ #undef LUAI_MAXALIGN #define LUAI_MAXALIGN lua_Number n; void *s; lua_Integer i; long l + +#define LUA_AVOID_FLOAT