diff options
| author | crimsonwoods <[email protected]> | 2013-03-21 22:58:33 +0900 |
|---|---|---|
| committer | crimsonwoods <[email protected]> | 2013-03-21 22:58:33 +0900 |
| commit | cc4e9ee5b65e5f35b7517e19dce5a5c62e0b2250 (patch) | |
| tree | d43704d3655c18891a18b15475d1997ebb07b6da /src | |
| parent | e06648a88d4369c8ffc1a0b5ff0cffd85e269477 (diff) | |
| download | mruby-cc4e9ee5b65e5f35b7517e19dce5a5c62e0b2250.tar.gz mruby-cc4e9ee5b65e5f35b7517e19dce5a5c62e0b2250.zip | |
fix the type of value that is returned by bit-shift expression.
Diffstat (limited to 'src')
| -rw-r--r-- | src/opcode.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/opcode.h b/src/opcode.h index 7c2ec204d..6b2288d48 100644 --- a/src/opcode.h +++ b/src/opcode.h @@ -20,17 +20,17 @@ #define GETARG_C(i) ((int)((((mrb_code)(i)) >> 7) & 0x7f)) #define GETARG_Bx(i) ((int)((((mrb_code)(i)) >> 7) & 0xffff)) #define GETARG_sBx(i) ((int)(GETARG_Bx(i)-MAXARG_sBx)) -#define GETARG_Ax(i) ((int)((((mrb_code)(i)) >> 7) & 0x1ffffff)) +#define GETARG_Ax(i) ((int32_t)((((mrb_code)(i)) >> 7) & 0x1ffffff)) #define GETARG_UNPACK_b(i,n1,n2) ((int)((((mrb_code)(i)) >> (7+n2)) & (((1<<n1)-1)))) #define GETARG_UNPACK_c(i,n1,n2) ((int)((((mrb_code)(i)) >> 7) & (((1<<n2)-1)))) #define GETARG_b(i) GETARG_UNPACK_b(i,14,2) #define GETARG_c(i) GETARG_UNPACK_c(i,14,2) #define MKOPCODE(op) ((op) & 0x7f) -#define MKARG_A(c) (((c) & 0x1ff) << 23) -#define MKARG_B(c) (((c) & 0x1ff) << 14) +#define MKARG_A(c) ((mrb_code)((c) & 0x1ff) << 23) +#define MKARG_B(c) ((mrb_code)((c) & 0x1ff) << 14) #define MKARG_C(c) (((c) & 0x7f) << 7) -#define MKARG_Bx(v) (((v) & 0xffff) << 7) +#define MKARG_Bx(v) ((mrb_code)((v) & 0xffff) << 7) #define MKARG_sBx(v) MKARG_Bx((v)+MAXARG_sBx) #define MKARG_Ax(v) (((v) & 0x1ffffff) << 7) #define MKARG_PACK(b,n1,c,n2) ((((b) & ((1<<n1)-1)) << (7+n2))|(((c) & ((1<<n2)-1)) << 7)) |
