diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-10-19 01:50:40 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-10-19 01:50:40 +0900 |
| commit | ac3b1c4c5a024301af54460e7846b880ed9de099 (patch) | |
| tree | e5002fc0b275aebd0a32fbc8c10b9d42906cc026 /src | |
| parent | 19cd9c6e2eaa4849f37228babdbc2868d6750bad (diff) | |
| download | mruby-ac3b1c4c5a024301af54460e7846b880ed9de099.tar.gz mruby-ac3b1c4c5a024301af54460e7846b880ed9de099.zip | |
lshift must not assume sizeof(long) >= sizeof(mrb_int)
Diffstat (limited to 'src')
| -rw-r--r-- | src/numeric.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/numeric.c b/src/numeric.c index 6970869df..284d0a82e 100644 --- a/src/numeric.c +++ b/src/numeric.c @@ -949,8 +949,7 @@ fix_xor(mrb_state *mrb, mrb_value x) static mrb_value lshift(mrb_state *mrb, mrb_int val, unsigned long width) { - if (width > (sizeof(mrb_int)*CHAR_BIT-1) - || ((unsigned long)abs(val))>>(sizeof(mrb_int)*CHAR_BIT-1-width) > 0) { + if (width > (sizeof(mrb_int)*CHAR_BIT-1)) { mrb_raise(mrb, E_RANGE_ERROR, "width(%d) > (%d:sizeof(mrb_int)*CHAR_BIT-1)", width, sizeof(mrb_int)*CHAR_BIT-1); } |
