diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | hash.c | 9 | ||||
-rw-r--r-- | version.h | 6 |
3 files changed, 14 insertions, 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] + Sun Mar 2 23:03:59 2008 Nobuyoshi Nakada <nobu@ruby-lang.org> * io.c (rb_io_ungetc): reduce redundant call. @@ -75,15 +75,16 @@ static int rb_any_hash(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: @@ -91,8 +92,10 @@ rb_any_hash(VALUE 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 const struct st_hash_type objhash = { @@ -1,7 +1,7 @@ #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_RELEASE_CODE 20080302 +#define RUBY_RELEASE_CODE 20080303 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 3 -#define RUBY_RELEASE_DAY 2 +#define RUBY_RELEASE_DAY 3 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; |