Skip to content

Instantly share code, notes, and snippets.

@headius
Created January 7, 2015 17:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save headius/2b65c9bbdc142d811cfe to your computer and use it in GitHub Desktop.
Save headius/2b65c9bbdc142d811cfe to your computer and use it in GitHub Desktop.
static VALUE
rb_ary_hash(VALUE ary)
{
long i;
st_index_t h;
VALUE n;
h = rb_hash_start(RARRAY_LEN(ary));
h = rb_hash_uint(h, (st_index_t)rb_ary_hash);
for (i=0; i<RARRAY_LEN(ary); i++) {
n = rb_hash(RARRAY_AREF(ary, i));
h = rb_hash_uint(h, NUM2LONG(n));
}
h = rb_hash_end(h);
return LONG2FIX(h);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment