summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorcrimsonwoods <[email protected]>2013-03-21 22:55:35 +0900
committercrimsonwoods <[email protected]>2013-03-21 22:55:35 +0900
commit0292940e557d91faa84b8570619226a75b8468d3 (patch)
tree955f21a4bf85bf25565626d39cf3e3beda0dfe2d /src
parentf6646f44c2a33147b7f491d1551243c96f72ab25 (diff)
downloadmruby-0292940e557d91faa84b8570619226a75b8468d3.tar.gz
mruby-0292940e557d91faa84b8570619226a75b8468d3.zip
fix the type of value that is returned by bit-shift expression.
Diffstat (limited to 'src')
-rw-r--r--src/codegen.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 7a91d597d..3141fafe1 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -580,7 +580,8 @@ lambda_body(codegen_scope *s, node *tree, int blk)
}
tree = tree->cdr;
if (tree->car) {
- int ma, oa, ra, pa, ka, kd, ba, a;
+ int32_t a;
+ int ma, oa, ra, pa, ka, kd, ba;
int pos, i;
node *n, *opt;
@@ -595,8 +596,8 @@ lambda_body(codegen_scope *s, node *tree, int blk)
ka = kd = 0;
ba = tree->car->cdr->cdr->cdr->cdr ? 1 : 0;
- a = ((ma & 0x1f) << 18)
- | ((oa & 0x1f) << 13)
+ a = ((int32_t)(ma & 0x1f) << 18)
+ | ((int32_t)(oa & 0x1f) << 13)
| ((ra & 1) << 12)
| ((pa & 0x1f) << 7)
| ((ka & 0x1f) << 2)