2 ** enum.c - Enumerable module
4 ** See Copyright Notice in mruby.h
8 #include <mruby/proc.h>
10 /* internal method `__update_hash(oldhash, index, itemhash)` */
12 enum_update_hash(mrb_state *mrb, mrb_value self)
18 mrb_get_args(mrb, "iii", &hash, &index, &hv);
19 hash ^= ((uint32_t)hv << (index % 16));
21 return mrb_fixnum_value(hash);
25 mrb_init_enumerable(mrb_state *mrb)
27 struct RClass *enumerable;
28 enumerable = mrb_define_module(mrb, "Enumerable"); /* 15.3.2 */
29 mrb_define_module_function(mrb, enumerable, "__update_hash", enum_update_hash, MRB_ARGS_REQ(1));