diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-10-01 16:13:43 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-10-01 16:13:43 -0300 |
| commit | bc1b0733b808f02639ed79fff02f69f731636539 (patch) | |
| tree | d90ae6263abb6fe1e6641e9a33981457418edea5 /lopcodes.h | |
| parent | 722bdbe17d0192baf72978f88069d12a921e9bfb (diff) | |
| download | lua-bc1b0733b808f02639ed79fff02f69f731636539.tar.gz lua-bc1b0733b808f02639ed79fff02f69f731636539.tar.bz2 lua-bc1b0733b808f02639ed79fff02f69f731636539.zip | |
avoid the use of bit 'Bk' ('B' will lose this bit soon)
Diffstat (limited to 'lopcodes.h')
| -rw-r--r-- | lopcodes.h | 9 |
1 files changed, 3 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lopcodes.h,v 1.161 2017/09/26 18:14:45 roberto Exp roberto $ | 2 | ** $Id: lopcodes.h,v 1.162 2017/09/28 16:53:29 roberto Exp roberto $ |
| 3 | ** Opcodes for Lua virtual machine | 3 | ** Opcodes for Lua virtual machine |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -73,6 +73,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ | |||
| 73 | #define MAXARG_A ((1<<SIZE_A)-1) | 73 | #define MAXARG_A ((1<<SIZE_A)-1) |
| 74 | #define MAXARG_B ((1<<SIZE_B)-1) | 74 | #define MAXARG_B ((1<<SIZE_B)-1) |
| 75 | #define MAXARG_C ((1<<SIZE_C)-1) | 75 | #define MAXARG_C ((1<<SIZE_C)-1) |
| 76 | #define MAXARG_Cr ((1<<(SIZE_C - 1))-1) | ||
| 76 | 77 | ||
| 77 | 78 | ||
| 78 | /* creates a mask with 'n' 1 bits at position 'p' */ | 79 | /* creates a mask with 'n' 1 bits at position 'p' */ |
| @@ -102,10 +103,6 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ | |||
| 102 | #define GETARG_B(i) check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B)) | 103 | #define GETARG_B(i) check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B)) |
| 103 | #define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B) | 104 | #define SETARG_B(i,v) setarg(i, v, POS_B, SIZE_B) |
| 104 | 105 | ||
| 105 | #define GETARG_Br(i) \ | ||
| 106 | check_exp(checkopm(i, iABC), getarg(i, POS_B, SIZE_B - 1)) | ||
| 107 | #define GETARG_Bk(i) getarg(i, (POS_B + SIZE_B - 1), 1) | ||
| 108 | |||
| 109 | #define GETARG_C(i) check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C)) | 106 | #define GETARG_C(i) check_exp(checkopm(i, iABC), getarg(i, POS_C, SIZE_C)) |
| 110 | #define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C) | 107 | #define SETARG_C(i,v) setarg(i, v, POS_C, SIZE_C) |
| 111 | 108 | ||
| @@ -142,7 +139,7 @@ enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ | |||
| 142 | */ | 139 | */ |
| 143 | 140 | ||
| 144 | /* this bit 1 means constant (0 means register) */ | 141 | /* this bit 1 means constant (0 means register) */ |
| 145 | #define BITRK (1 << (SIZE_B - 1)) | 142 | #define BITRK (1 << (SIZE_C - 1)) |
| 146 | 143 | ||
| 147 | /* test whether value is a constant */ | 144 | /* test whether value is a constant */ |
| 148 | #define ISK(x) ((x) & BITRK) | 145 | #define ISK(x) ((x) & BITRK) |
