summaryrefslogtreecommitdiff
path: root/src/lib_io.c
diff options
context:
space:
mode:
authorMike Pall <mike>2011-02-27 01:36:59 +0100
committerMike Pall <mike>2011-02-27 01:36:59 +0100
commitcead25f928ac606fc1a13882b818913aab3635a9 (patch)
tree92121b401f76f4b2891ebac0f710b0a921ce13b1 /src/lib_io.c
parentc031d4b6a06eab94e8d9b837ec6dc257899a4ae1 (diff)
downloadluajit-cead25f928ac606fc1a13882b818913aab3635a9.tar.gz
luajit-cead25f928ac606fc1a13882b818913aab3635a9.tar.bz2
luajit-cead25f928ac606fc1a13882b818913aab3635a9.zip
DUALNUM: Handle integer type in x86/x64 interpreter and libraries.
Diffstat (limited to 'src/lib_io.c')
-rw-r--r--src/lib_io.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib_io.c b/src/lib_io.c
index d3dac7a0..f4888c1c 100644
--- a/src/lib_io.c
+++ b/src/lib_io.c
@@ -137,6 +137,13 @@ static int io_file_readnum(lua_State *L, FILE *fp)
137{ 137{
138 lua_Number d; 138 lua_Number d;
139 if (fscanf(fp, LUA_NUMBER_SCAN, &d) == 1) { 139 if (fscanf(fp, LUA_NUMBER_SCAN, &d) == 1) {
140 if (LJ_DUALNUM) {
141 int32_t i = lj_num2int(d);
142 if (d == (lua_Number)i && !tvismzero((cTValue *)&d)) {
143 setintV(L->top++, i);
144 return 1;
145 }
146 }
140 setnumV(L->top++, d); 147 setnumV(L->top++, d);
141 return 1; 148 return 1;
142 } else { 149 } else {
@@ -217,7 +224,7 @@ static int io_file_read(lua_State *L, FILE *fp, int start)
217 io_file_readchars(L, fp, ~((size_t)0)); 224 io_file_readchars(L, fp, ~((size_t)0));
218 else 225 else
219 lj_err_arg(L, n+1, LJ_ERR_INVFMT); 226 lj_err_arg(L, n+1, LJ_ERR_INVFMT);
220 } else if (tvisnum(L->base+n)) { 227 } else if (tvisnumber(L->base+n)) {
221 size_t len = (size_t)lj_lib_checkint(L, n+1); 228 size_t len = (size_t)lj_lib_checkint(L, n+1);
222 ok = len ? io_file_readchars(L, fp, len) : io_file_testeof(L, fp); 229 ok = len ? io_file_readchars(L, fp, len) : io_file_testeof(L, fp);
223 } else { 230 } else {