-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlua.pat
64 lines (57 loc) · 1.59 KB
/
lua.pat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--- lua/lopcodes.h
+++ lua/lopcodes.h
@@ -67,8 +67,9 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
/* Check whether type 'int' has at least 'b' bits ('b' < 32) */
#define L_INTHASBITS(b) ((UINT_MAX >> ((b) - 1)) >= 1)
-
-#if L_INTHASBITS(SIZE_Bx)
+#if defined(_M_I86)
+#define MAXARG_Bx MAX_INT
+#elif L_INTHASBITS(SIZE_Bx)
#define MAXARG_Bx ((1<<SIZE_Bx)-1)
#else
#define MAXARG_Bx MAX_INT
@@ -76,14 +77,17 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */
#define OFFSET_sBx (MAXARG_Bx>>1) /* 'sBx' is signed */
-
-#if L_INTHASBITS(SIZE_Ax)
+#if defined(_M_I86)
+#define MAXARG_Ax MAX_INT
+#elif L_INTHASBITS(SIZE_Ax)
#define MAXARG_Ax ((1<<SIZE_Ax)-1)
#else
#define MAXARG_Ax MAX_INT
#endif
-#if L_INTHASBITS(SIZE_sJ)
+#if defined(_M_I86)
+#define MAXARG_sJ MAX_INT
+#elif L_INTHASBITS(SIZE_sJ)
#define MAXARG_sJ ((1 << SIZE_sJ) - 1)
#else
#define MAXARG_sJ MAX_INT
--- lua/luaconf.h
+++ lua/luaconf.h
@@ -79,7 +79,12 @@
/*
@@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits.
*/
+#if defined(_M_I86)
+/* Hardcoded due to bugs in some 16-bit compilers */
+#define LUAI_IS32INT 0
+#else
#define LUAI_IS32INT ((UINT_MAX >> 30) >= 3)
+#endif
/* }================================================================== */
--- lua/lutf8lib.c
+++ lua/lutf8lib.c
@@ -31,7 +31,9 @@
/*
** Integer type for decoded UTF-8 values; MAXUTF needs 31 bits.
*/
-#if (UINT_MAX >> 30) >= 1
+#if defined(_M_I86)
+typedef unsigned long utfint;
+#elif (UINT_MAX >> 30) >= 1
typedef unsigned int utfint;
#else
typedef unsigned long utfint;