~ubuntu-branches/ubuntu/trusty/luajit/trusty

« back to all changes in this revision

Viewing changes to debian/patches/beta9_hotfix1.patch

  • Committer: Package Import Robot
  • Author(s): Enrico Tassi
  • Date: 2012-11-03 14:07:56 UTC
  • mfrom: (1.2.1) (15.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20121103140756-z0zcnyrwqlvuc2m5
Tags: 2.0.0+dfsg-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Fix parsing of hex literals with exponents.
2
 
Fix bytecode dump for certain number constants.
3
 
 
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
8
 
@@ -137,14 +137,17 @@
9
 
 /* Parse a number literal. */
10
 
 static void lex_number(LexState *ls, TValue *tv)
11
 
 {
12
 
-  int c;
13
 
+  int c, xp = 'E';
14
 
   lua_assert(lj_char_isdigit(ls->current));
15
 
-  do {
16
 
+  if ((c = ls->current) == '0') {
17
 
+    save_and_next(ls);
18
 
+    if ((ls->current & ~0x20) == 'X') xp = 'P';
19
 
+  }
20
 
+  while (lj_char_isident(ls->current) || ls->current == '.' ||
21
 
+        ((ls->current == '-' || ls->current == '+') && (c & ~0x20) == xp)) {
22
 
     c = ls->current;
23
 
     save_and_next(ls);
24
 
-  } while (lj_char_isident(ls->current) || ls->current == '.' ||
25
 
-          ((ls->current == '-' || ls->current == '+') &&
26
 
-           ((c & ~0x20) == 'E' || (c & ~0x20) == 'P')));
27
 
+  }
28
 
 #if LJ_HASFFI
29
 
   c &= ~0x20;
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
35
 
@@ -219,13 +219,19 @@
36
 
        k = lj_num2int(num);
37
 
        if (num == (lua_Number)k) {  /* -0 is never a constant. */
38
 
        save_int:
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));
42
 
+         if (k < 0) {
43
 
+           char *p = &ctx->sb.buf[ctx->sb.n-1];
44
 
+           *p = (*p & 7) | ((k>>27) & 0x18);
45
 
+         }
46
 
          continue;
47
 
        }
48
 
       }
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);
55
 
+      }
56
 
       bcwrite_uleb128(ctx, o->u32.hi);
57
 
     }
58
 
   }