diff options
author | David Walter Seikel | 2012-02-04 19:11:16 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-02-04 19:11:16 +1000 |
commit | 8269cd00762a808ac73f18a02085cc77958d6e6d (patch) | |
tree | e054c2e7b31eb06489f9700f945411cd70f09009 /libraries/luajit-2.0/src/lj_bcwrite.c | |
parent | Fix up "assignments in the middle of expressions is legal in LSL, but not in ... (diff) | |
download | SledjHamr-8269cd00762a808ac73f18a02085cc77958d6e6d.zip SledjHamr-8269cd00762a808ac73f18a02085cc77958d6e6d.tar.gz SledjHamr-8269cd00762a808ac73f18a02085cc77958d6e6d.tar.bz2 SledjHamr-8269cd00762a808ac73f18a02085cc77958d6e6d.tar.xz |
Apply LuaJIT hotfix1.
Diffstat (limited to '')
-rw-r--r-- | libraries/luajit-2.0/src/lj_bcwrite.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/libraries/luajit-2.0/src/lj_bcwrite.c b/libraries/luajit-2.0/src/lj_bcwrite.c index de9b4cf..f177465 100644 --- a/libraries/luajit-2.0/src/lj_bcwrite.c +++ b/libraries/luajit-2.0/src/lj_bcwrite.c | |||
@@ -216,19 +216,27 @@ static void bcwrite_knum(BCWriteCtx *ctx, GCproto *pt) | |||
216 | /* Write a 33 bit ULEB128 for the int (lsb=0) or loword (lsb=1). */ | 216 | /* Write a 33 bit ULEB128 for the int (lsb=0) or loword (lsb=1). */ |
217 | if (!LJ_DUALNUM) { /* Narrow number constants to integers. */ | 217 | if (!LJ_DUALNUM) { /* Narrow number constants to integers. */ |
218 | lua_Number num = numV(o); | 218 | lua_Number num = numV(o); |
219 | k = lj_num2int(num); | 219 | |
220 | if (num == (lua_Number)k) { /* -0 is never a constant. */ | 220 | |
221 | save_int: | 221 | k = lj_num2int(num); |
222 | bcwrite_uleb128(ctx, 2*(uint32_t)k); | 222 | if (num == (lua_Number)k) { /* -0 is never a constant. */ |
223 | if (k < 0) ctx->sb.buf[ctx->sb.n-1] |= 0x10; | 223 | save_int: |
224 | continue; | 224 | bcwrite_uleb128(ctx, 2*(uint32_t)k | ((uint32_t)k & 0x80000000u)); |
225 | } | 225 | if (k < 0) { |
226 | } | 226 | char *p = &ctx->sb.buf[ctx->sb.n-1]; |
227 | bcwrite_uleb128(ctx, 1+2*o->u32.lo); | 227 | *p = (*p & 7) | ((k>>27) & 0x18); |
228 | if (o->u32.lo >= 0x80000000u) ctx->sb.buf[ctx->sb.n-1] |= 0x10; | 228 | } |
229 | bcwrite_uleb128(ctx, o->u32.hi); | 229 | continue; |
230 | } | 230 | } |
231 | } | 231 | } |
232 | bcwrite_uleb128(ctx, 1+(2*o->u32.lo | (o->u32.lo & 0x80000000u))); | ||
233 | if (o->u32.lo >= 0x80000000u) { | ||
234 | char *p = &ctx->sb.buf[ctx->sb.n-1]; | ||
235 | *p = (*p & 7) | ((o->u32.lo>>27) & 0x18); | ||
236 | } | ||
237 | bcwrite_uleb128(ctx, o->u32.hi); | ||
238 | } | ||
239 | } | ||
232 | } | 240 | } |
233 | 241 | ||
234 | /* Write bytecode instructions. */ | 242 | /* Write bytecode instructions. */ |