* hash.c (rb_any_hash): shrinks all results in Fixnum range.
[ruby-core:15713] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3b5d60c0b1
commit
9b2dd1e20d
@ -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]
|
||||||
|
|
||||||
Sun Mar 2 23:03:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Mar 2 23:03:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (rb_io_ungetc): reduce redundant call.
|
* io.c (rb_io_ungetc): reduce redundant call.
|
||||||
|
9
hash.c
9
hash.c
@ -75,15 +75,16 @@ static int
|
|||||||
rb_any_hash(VALUE a)
|
rb_any_hash(VALUE a)
|
||||||
{
|
{
|
||||||
VALUE hval;
|
VALUE hval;
|
||||||
|
int hnum;
|
||||||
|
|
||||||
switch (TYPE(a)) {
|
switch (TYPE(a)) {
|
||||||
case T_FIXNUM:
|
case T_FIXNUM:
|
||||||
case T_SYMBOL:
|
case T_SYMBOL:
|
||||||
return (int)a;
|
hnum = (int)a;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
return rb_str_hash(a);
|
hnum = rb_str_hash(a);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -91,8 +92,10 @@ rb_any_hash(VALUE a)
|
|||||||
if (!FIXNUM_P(hval)) {
|
if (!FIXNUM_P(hval)) {
|
||||||
hval = rb_funcall(hval, '%', 1, INT2FIX(536870923));
|
hval = rb_funcall(hval, '%', 1, INT2FIX(536870923));
|
||||||
}
|
}
|
||||||
return (int)FIX2LONG(hval);
|
hnum = (int)FIX2LONG(hval);
|
||||||
}
|
}
|
||||||
|
hnum <<= 1;
|
||||||
|
return RSHIFT(hnum, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct st_hash_type objhash = {
|
static const struct st_hash_type objhash = {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#define RUBY_VERSION "1.9.0"
|
#define RUBY_VERSION "1.9.0"
|
||||||
#define RUBY_RELEASE_DATE "2008-03-02"
|
#define RUBY_RELEASE_DATE "2008-03-03"
|
||||||
#define RUBY_VERSION_CODE 190
|
#define RUBY_VERSION_CODE 190
|
||||||
#define RUBY_RELEASE_CODE 20080302
|
#define RUBY_RELEASE_CODE 20080303
|
||||||
#define RUBY_PATCHLEVEL 0
|
#define RUBY_PATCHLEVEL 0
|
||||||
|
|
||||||
#define RUBY_VERSION_MAJOR 1
|
#define RUBY_VERSION_MAJOR 1
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_YEAR 2008
|
#define RUBY_RELEASE_YEAR 2008
|
||||||
#define RUBY_RELEASE_MONTH 3
|
#define RUBY_RELEASE_MONTH 3
|
||||||
#define RUBY_RELEASE_DAY 2
|
#define RUBY_RELEASE_DAY 3
|
||||||
|
|
||||||
#ifdef RUBY_EXTERN
|
#ifdef RUBY_EXTERN
|
||||||
RUBY_EXTERN const char ruby_version[];
|
RUBY_EXTERN const char ruby_version[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user