diff options
| author | KOBAYASHI Shuji <[email protected]> | 2020-07-25 16:59:02 +0900 |
|---|---|---|
| committer | KOBAYASHI Shuji <[email protected]> | 2020-07-25 16:59:02 +0900 |
| commit | 0c88c717861a4ec182e41f2c290ec0ef31029967 (patch) | |
| tree | 771eca4fe4275277c3a33747d1729474728c05db /src/opcode.h | |
| parent | b4f4f5968b7c5e05b91bf7a62a0438b0d4c9133e (diff) | |
| download | mruby-0c88c717861a4ec182e41f2c290ec0ef31029967.tar.gz mruby-0c88c717861a4ec182e41f2c290ec0ef31029967.zip | |
Use type tag for hash code in `ht_hash_func()`
The function corresponding to `ht_hash_func()` was as follows in the days of
khash implementation (before d78acc7a).
```c
mrb_hash_ht_hash_func(mrb_state *mrb, mrb_value key)
{
enum mrb_vtype t = mrb_type(key);
...
switch (t) {
...
default:
hv = mrb_funcall(mrb, key, "hash", 0);
h = (khint_t)t ^ (khint_t)mrb_fixnum(hv);
break;
}
...
}
```
When switched to the segmented list implementation (d78acc7a), this function
was changed as follows.
```c
sg_hash_func(mrb_state *mrb, seglist *t, mrb_value key)
{
enum mrb_vtype tt = mrb_type(key);
...
switch (tt) {
...
default:
hv = mrb_funcall(mrb, key, "hash", 0);
h = (size_t)t ^ (size_t)mrb_fixnum(hv);
break;
}
...
}
```
Since the argument `t` was added, the variable for type tag was changed from
`t` to `tt`, but the variable used in the expression of `h` remained `t`.
Probably this is an omission of change, so fixed it.
Diffstat (limited to 'src/opcode.h')
0 files changed, 0 insertions, 0 deletions
