diff options
author | Mike Pall <mike> | 2011-08-26 20:29:05 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2011-08-26 20:29:05 +0200 |
commit | 32c1d4751a302dc7838659477fe8605e3c14eabb (patch) | |
tree | a6aa3659cd926d6dd821550b5bb4ba2df515ffee | |
parent | 6627744752f1769cec7bc3492496130175145957 (diff) | |
download | luajit-32c1d4751a302dc7838659477fe8605e3c14eabb.tar.gz luajit-32c1d4751a302dc7838659477fe8605e3c14eabb.tar.bz2 luajit-32c1d4751a302dc7838659477fe8605e3c14eabb.zip |
Avoid conversion narrowing of arithmetic with large constants.
-rw-r--r-- | src/lj_opt_narrow.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lj_opt_narrow.c b/src/lj_opt_narrow.c index 37fda0b6..d9d1e2ba 100644 --- a/src/lj_opt_narrow.c +++ b/src/lj_opt_narrow.c | |||
@@ -284,7 +284,8 @@ static int narrow_conv_backprop(NarrowConv *nc, IRRef ref, int depth) | |||
284 | } | 284 | } |
285 | } else { | 285 | } else { |
286 | int32_t k = lj_num2int(n); | 286 | int32_t k = lj_num2int(n); |
287 | if (n == (lua_Number)k) { /* Only if constant is really an integer. */ | 287 | /* Only if constant is a small integer. */ |
288 | if (checki16(k) && n == (lua_Number)k) { | ||
288 | *nc->sp++ = NARROWINS(NARROW_INT, 0); | 289 | *nc->sp++ = NARROWINS(NARROW_INT, 0); |
289 | *nc->sp++ = (NarrowIns)k; | 290 | *nc->sp++ = (NarrowIns)k; |
290 | return 0; | 291 | return 0; |