1
Fix parsing of hex literals with exponents.
2
Fix bytecode dump for certain number constants.
4
Index: luajit-2.0.0~beta9+dfsg/src/lj_lex.c
5
===================================================================
6
--- luajit-2.0.0~beta9+dfsg.orig/src/lj_lex.c 2011-12-14 15:15:00.000000000 +0100
7
+++ luajit-2.0.0~beta9+dfsg/src/lj_lex.c 2012-02-04 13:29:50.000000000 +0100
9
/* Parse a number literal. */
10
static void lex_number(LexState *ls, TValue *tv)
14
lua_assert(lj_char_isdigit(ls->current));
16
+ if ((c = ls->current) == '0') {
18
+ if ((ls->current & ~0x20) == 'X') xp = 'P';
20
+ while (lj_char_isident(ls->current) || ls->current == '.' ||
21
+ ((ls->current == '-' || ls->current == '+') && (c & ~0x20) == xp)) {
24
- } while (lj_char_isident(ls->current) || ls->current == '.' ||
25
- ((ls->current == '-' || ls->current == '+') &&
26
- ((c & ~0x20) == 'E' || (c & ~0x20) == 'P')));
30
if ((c == 'I' || c == 'L' || c == 'U') && !ctype_ctsG(G(ls->L)))
31
Index: luajit-2.0.0~beta9+dfsg/src/lj_bcwrite.c
32
===================================================================
33
--- luajit-2.0.0~beta9+dfsg.orig/src/lj_bcwrite.c 2011-12-14 15:15:00.000000000 +0100
34
+++ luajit-2.0.0~beta9+dfsg/src/lj_bcwrite.c 2012-02-04 13:29:50.000000000 +0100
37
if (num == (lua_Number)k) { /* -0 is never a constant. */
39
- bcwrite_uleb128(ctx, 2*(uint32_t)k);
40
- if (k < 0) ctx->sb.buf[ctx->sb.n-1] |= 0x10;
41
+ bcwrite_uleb128(ctx, 2*(uint32_t)k | ((uint32_t)k & 0x80000000u));
43
+ char *p = &ctx->sb.buf[ctx->sb.n-1];
44
+ *p = (*p & 7) | ((k>>27) & 0x18);
49
- bcwrite_uleb128(ctx, 1+2*o->u32.lo);
50
- if (o->u32.lo >= 0x80000000u) ctx->sb.buf[ctx->sb.n-1] |= 0x10;
51
+ bcwrite_uleb128(ctx, 1+(2*o->u32.lo | (o->u32.lo & 0x80000000u)));
52
+ if (o->u32.lo >= 0x80000000u) {
53
+ char *p = &ctx->sb.buf[ctx->sb.n-1];
54
+ *p = (*p & 7) | ((o->u32.lo>>27) & 0x18);
56
bcwrite_uleb128(ctx, o->u32.hi);