mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* hash.c (rb_any_hash): shrinks all results in Fixnum range.
[ruby-core:15713] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
9343634c6d
commit
58ee1e54b0
3 changed files with 14 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Mar 3 16:14:24 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* hash.c (rb_any_hash): shrinks all results in Fixnum range.
|
||||
[ruby-core:15713]
|
||||
|
||||
Sat Mar 1 02:35:08 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* bignum.c (big2str_find_n1): check integer overflow.
|
||||
|
|
9
hash.c
9
hash.c
|
@ -89,15 +89,16 @@ rb_any_hash(a)
|
|||
VALUE a;
|
||||
{
|
||||
VALUE hval;
|
||||
int hnum;
|
||||
|
||||
switch (TYPE(a)) {
|
||||
case T_FIXNUM:
|
||||
case T_SYMBOL:
|
||||
return (int)a;
|
||||
hnum = (int)a;
|
||||
break;
|
||||
|
||||
case T_STRING:
|
||||
return rb_str_hash(a);
|
||||
hnum = rb_str_hash(a);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -105,8 +106,10 @@ rb_any_hash(a)
|
|||
if (!FIXNUM_P(hval)) {
|
||||
hval = rb_funcall(hval, '%', 1, INT2FIX(536870923));
|
||||
}
|
||||
return (int)FIX2LONG(hval);
|
||||
hnum = (int)FIX2LONG(hval);
|
||||
}
|
||||
hnum <<= 1;
|
||||
return RSHIFT(hnum, 1);
|
||||
}
|
||||
|
||||
static struct st_hash_type objhash = {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#define RUBY_VERSION "1.8.6"
|
||||
#define RUBY_RELEASE_DATE "2008-03-01"
|
||||
#define RUBY_RELEASE_DATE "2008-03-03"
|
||||
#define RUBY_VERSION_CODE 186
|
||||
#define RUBY_RELEASE_CODE 20080301
|
||||
#define RUBY_RELEASE_CODE 20080303
|
||||
#define RUBY_PATCHLEVEL 5000
|
||||
|
||||
#define RUBY_VERSION_MAJOR 1
|
||||
|
@ -9,7 +9,7 @@
|
|||
#define RUBY_VERSION_TEENY 6
|
||||
#define RUBY_RELEASE_YEAR 2008
|
||||
#define RUBY_RELEASE_MONTH 3
|
||||
#define RUBY_RELEASE_DAY 1
|
||||
#define RUBY_RELEASE_DAY 3
|
||||
|
||||
#ifdef RUBY_EXTERN
|
||||
RUBY_EXTERN const char ruby_version[];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue