Created
August 29, 2009 23:40
-
-
Save methodmissing/177755 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int | |
| rb_any_hash(a) | |
| VALUE a; | |
| { | |
| VALUE hval; | |
| switch (TYPE(a)) { | |
| case T_FIXNUM: | |
| case T_SYMBOL: | |
| return (int)a; | |
| break; | |
| case T_STRING: | |
| return rb_str_hash(a); | |
| break; | |
| default: | |
| hval = rb_funcall(a, id_hash, 0); | |
| if (!FIXNUM_P(hval)) { | |
| hval = rb_funcall(hval, '%', 1, INT2FIX(536870923)); | |
| } | |
| return (int)FIX2LONG(hval); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment