summaryrefslogtreecommitdiffhomepage
path: root/src/numeric.c
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-10-19 01:50:40 +0900
committerYukihiro Matsumoto <[email protected]>2012-10-19 01:50:40 +0900
commitac3b1c4c5a024301af54460e7846b880ed9de099 (patch)
treee5002fc0b275aebd0a32fbc8c10b9d42906cc026 /src/numeric.c
parent19cd9c6e2eaa4849f37228babdbc2868d6750bad (diff)
downloadmruby-ac3b1c4c5a024301af54460e7846b880ed9de099.tar.gz
mruby-ac3b1c4c5a024301af54460e7846b880ed9de099.zip
lshift must not assume sizeof(long) >= sizeof(mrb_int)
Diffstat (limited to 'src/numeric.c')
-rw-r--r--src/numeric.c3
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);
}