summaryrefslogtreecommitdiff
path: root/contrib/lua
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-01-26 17:56:20 +0000
committerWarner Losh <imp@FreeBSD.org>2018-01-26 17:56:20 +0000
commit919cf86c871a6f98fe3174189571bdb07f012950 (patch)
treee75a7a89c93f9dc6a6c645636a16af98dfe8c82e /contrib/lua
parent4dbbaf2021dd86d2c5e8bd83949ded4025e139ca (diff)
downloadsrc-test-919cf86c871a6f98fe3174189571bdb07f012950.tar.gz
src-test-919cf86c871a6f98fe3174189571bdb07f012950.zip
Gross hack to omit printing hex floating point when the lua number
type is int64. While lua is setup for the representation, it's not setup to properly print the numbers as ints. This is the least-gross way around that, and won't affect the bootloader where we do this.
Notes
Notes: svn path=/head/; revision=328443
Diffstat (limited to 'contrib/lua')
-rw-r--r--contrib/lua/src/lstrlib.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/contrib/lua/src/lstrlib.c b/contrib/lua/src/lstrlib.c
index c7aa755fabd2b..1d53765e57327 100644
--- a/contrib/lua/src/lstrlib.c
+++ b/contrib/lua/src/lstrlib.c
@@ -951,12 +951,16 @@ static void addliteral (lua_State *L, luaL_Buffer *b, int arg) {
case LUA_TNUMBER: {
char *buff = luaL_prepbuffsize(b, MAX_ITEM);
int nb;
+#if LUA_FLOAT_TYPE != LUA_FLOAT_INT64
if (!lua_isinteger(L, arg)) { /* float? */
lua_Number n = lua_tonumber(L, arg); /* write as hexa ('%a') */
nb = lua_number2strx(L, buff, MAX_ITEM, "%" LUA_NUMBER_FRMLEN "a", n);
checkdp(buff, nb); /* ensure it uses a dot */
}
else { /* integers */
+#else
+ {
+#endif
lua_Integer n = lua_tointeger(L, arg);
const char *format = (n == LUA_MININTEGER) /* corner case? */
? "0x%" LUA_INTEGER_FRMLEN "x" /* use hexa */