diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-03 07:14:27 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-03-03 07:14:27 +0000 |
| commit | bc1e4240ab9c1f4b77b7efc97ebe5cfef3880a3d (patch) | |
| tree | 13f8b9317108e87ceef31003b4838032025140ff | |
| parent | 01e13c555c269e4d469126e1f0022a01dc3e875d (diff) | |
| download | ruby-bc1e4240ab9c1f4b77b7efc97ebe5cfef3880a3d.tar.gz ruby-bc1e4240ab9c1f4b77b7efc97ebe5cfef3880a3d.tar.xz ruby-bc1e4240ab9c1f4b77b7efc97ebe5cfef3880a3d.zip | |
* hash.c (rb_any_hash): shrinks all results in Fixnum range.
[ruby-core:15713]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@15672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -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[]; |
