|
1 | 1 | --- lua/lopcodes.h |
2 | 2 | +++ lua/lopcodes.h |
3 | | -@@ -65,10 +65,16 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ |
4 | | - */ |
5 | | - |
| 3 | +@@ -67,8 +67,9 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ |
6 | 4 | /* Check whether type 'int' has at least 'b' bits ('b' < 32) */ |
7 | | -+#if defined(_M_I86) |
8 | | -+/* Hardcoded due to bugs in some 16-bit compilers */ |
9 | | -+#define L_INTHASBITS(b) ((0xFFFF >> ((b) - 1)) >= 1) |
10 | | -+#else |
11 | 5 | #define L_INTHASBITS(b) ((UINT_MAX >> ((b) - 1)) >= 1) |
12 | | -+#endif |
13 | 6 |
|
14 | 7 | - |
15 | 8 | -#if L_INTHASBITS(SIZE_Bx) |
16 | 9 | +#if defined(_M_I86) |
17 | | -+#define MAXARG_Bx 0xFFFF |
| 10 | ++#define MAXARG_Bx MAX_INT |
18 | 11 | +#elif L_INTHASBITS(SIZE_Bx) |
19 | 12 | #define MAXARG_Bx ((1<<SIZE_Bx)-1) |
20 | 13 | #else |
21 | 14 | #define MAXARG_Bx MAX_INT |
22 | | -@@ -76,14 +82,17 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ |
| 15 | +@@ -76,14 +77,17 @@ enum OpMode {iABC, iABx, iAsBx, iAx, isJ}; /* basic instruction formats */ |
23 | 16 |
|
24 | 17 | #define OFFSET_sBx (MAXARG_Bx>>1) /* 'sBx' is signed */ |
25 | 18 |
|
26 | 19 | - |
27 | 20 | -#if L_INTHASBITS(SIZE_Ax) |
28 | 21 | +#if defined(_M_I86) |
29 | | -+#define MAXARG_Ax 0xFFFF |
| 22 | ++#define MAXARG_Ax MAX_INT |
30 | 23 | +#elif L_INTHASBITS(SIZE_Ax) |
31 | 24 | #define MAXARG_Ax ((1<<SIZE_Ax)-1) |
32 | 25 | #else |
|
35 | 28 |
|
36 | 29 | -#if L_INTHASBITS(SIZE_sJ) |
37 | 30 | +#if defined(_M_I86) |
38 | | -+#define MAXARG_sJ 0xFFFF |
| 31 | ++#define MAXARG_sJ MAX_INT |
39 | 32 | +#elif L_INTHASBITS(SIZE_sJ) |
40 | 33 | #define MAXARG_sJ ((1 << SIZE_sJ) - 1) |
41 | 34 | #else |
|
0 commit comments