mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* numeric.c (fix_lshift): negative shift count means right shift.
(ruby-bugs-ja:PR#248) * numeric.c (fix_rshift): return -1 when left side operand is negative. (ruby-bugs-ja:PR#247) * parse.y (yylex): `0_' should be an error. (ruby-bugs-ja:PR#239) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
11c11e9b46
commit
58c1c90731
3 changed files with 21 additions and 2 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Mon Jun 10 19:02:19 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
|
||||
|
||||
* numeric.c (fix_lshift): negative shift count means right shift.
|
||||
(ruby-bugs-ja:PR#248)
|
||||
|
||||
* numeric.c (fix_rshift): return -1 when left side operand is
|
||||
negative. (ruby-bugs-ja:PR#247)
|
||||
|
||||
* parse.y (yylex): `0_' should be an error. (ruby-bugs-ja:PR#239)
|
||||
|
||||
Wed Jun 5 18:53:06 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* math.c (Init_Math): backport asin, acos, atan.
|
||||
|
|
|
@ -1264,6 +1264,8 @@ fix_xor(x, y)
|
|||
return rb_int2inum(val);
|
||||
}
|
||||
|
||||
static VALUE fix_rshift _((VALUE, VALUE));
|
||||
|
||||
static VALUE
|
||||
fix_lshift(x, y)
|
||||
VALUE x, y;
|
||||
|
@ -1272,6 +1274,8 @@ fix_lshift(x, y)
|
|||
|
||||
val = NUM2LONG(x);
|
||||
width = NUM2LONG(y);
|
||||
if (width < 0)
|
||||
return fix_rshift(x, INT2FIX(-width));
|
||||
if (width > (sizeof(VALUE)*CHAR_BIT-1)
|
||||
|| ((unsigned long)val)>>(sizeof(VALUE)*CHAR_BIT-1-width) > 0) {
|
||||
return rb_big_lshift(rb_int2big(val), y);
|
||||
|
@ -1290,11 +1294,12 @@ fix_rshift(x, y)
|
|||
if (i < 0)
|
||||
return fix_lshift(x, INT2FIX(-i));
|
||||
if (i == 0) return x;
|
||||
val = FIX2LONG(x);
|
||||
if (i >= sizeof(long)*CHAR_BIT-1) {
|
||||
if (i < 0) return INT2FIX(-1);
|
||||
if (val < 0) return INT2FIX(-1);
|
||||
return INT2FIX(0);
|
||||
}
|
||||
val = RSHIFT(FIX2LONG(x), i);
|
||||
val = RSHIFT(val, i);
|
||||
return INT2FIX(val);
|
||||
}
|
||||
|
||||
|
|
4
parse.y
4
parse.y
|
@ -3356,6 +3356,10 @@ yylex()
|
|||
yylval.val = rb_cstr2inum(tok(), 8);
|
||||
return tINTEGER;
|
||||
}
|
||||
if (nondigit) {
|
||||
pushback(c);
|
||||
goto trailing_uc;
|
||||
}
|
||||
}
|
||||
if (c > '7' && c <= '9') {
|
||||
yyerror("Illegal octal digit");
|
||||
|
|
Loading…
Add table
Reference in a new issue