summaryrefslogtreecommitdiffhomepage
path: root/src/enum.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-11-15 21:01:25 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2018-11-15 21:01:56 +0900
commit56db3cf3eb35e430f73d31468b8cad37e21538c7 (patch)
tree4f0fec595599e3911db1e6a38bea27511eeefe0e /src/enum.c
parentf39f428ed4cce826e3cc1e59a323369a2932ed75 (diff)
downloadmruby-56db3cf3eb35e430f73d31468b8cad37e21538c7.tar.gz
mruby-56db3cf3eb35e430f73d31468b8cad37e21538c7.zip
Simplify argument parsing; ref #4161
Diffstat (limited to 'src/enum.c')
-rw-r--r--src/enum.c16
1 files changed, 1 insertions, 15 deletions
diff --git a/src/enum.c b/src/enum.c
index 38f004f51..1e9445176 100644
--- a/src/enum.c
+++ b/src/enum.c
@@ -14,22 +14,8 @@ enum_update_hash(mrb_state *mrb, mrb_value self)
mrb_int hash;
mrb_int index;
mrb_int hv;
- mrb_value item_hash;
- mrb_get_args(mrb, "iio", &hash, &index, &item_hash);
- if (mrb_fixnum_p(item_hash)) {
- hv = mrb_fixnum(item_hash);
- }
-#ifndef MRB_WITHOUT_FLOAT
- else if (mrb_float_p(item_hash)) {
- hv = (mrb_int)mrb_float(item_hash);
- }
-#endif
- else {
- mrb_raise(mrb, E_TYPE_ERROR, "can't calculate hash");
- /* not reached */
- hv = 0;
- }
+ mrb_get_args(mrb, "iii", &hash, &index, &hv);
hash ^= ((uint32_t)hv << (index % 16));
return mrb_fixnum_value(hash);