summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-30 22:55:31 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-10-30 22:55:31 +0000
commit357967567066099d22480b54422f175de8b24160 (patch)
tree11b27a8c0a6292fb500bf6506ebc8f6f06db4492 /hash.c
parent3bdd8e74f3b54b55be122bcc4a86e8bb25461cf4 (diff)
fix type.
* internal.h (RHASH_ARRAY_SIZE_RAW): should be `int` because it returns n<=8. * hash.c (RHASH_ARRAY_BOUND_RAW): ditto. * hash.c (RHASH_ARRAY_SIZE_RAW): remove a duplicated definition. * hash.c (linear_keys, linear_values): return `long`. * hash.c (linear_keys): fix initialize expression of `key_end`. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/hash.c b/hash.c
index ade10e2..76e367c 100644
--- a/hash.c
+++ b/hash.c
@@ -347,15 +347,12 @@ empty_entry(li_table_entry *entry)
return entry->hash == 0;
}
-#define RHASH_ARRAY_SIZE_RAW(h) \
- ((long)((RBASIC(h)->flags & RHASH_ARRAY_SIZE_MASK) >> RHASH_ARRAY_SIZE_SHIFT))
-
#define RHASH_ARRAY_SIZE(h) (HASH_ASSERT(RHASH_ARRAY_P(h)), \
RHASH_ARRAY_SIZE_RAW(h))
#define RHASH_ARRAY_BOUND_RAW(h) \
- ((long)((RBASIC(h)->flags >> RHASH_ARRAY_BOUND_SHIFT) & \
- (RHASH_ARRAY_BOUND_MASK >> RHASH_ARRAY_BOUND_SHIFT)))
+ ((int)((RBASIC(h)->flags >> RHASH_ARRAY_BOUND_SHIFT) & \
+ (RHASH_ARRAY_BOUND_MASK >> RHASH_ARRAY_BOUND_SHIFT)))
#define RHASH_ARRAY_BOUND(h) (HASH_ASSERT(RHASH_ARRAY_P(h)), \
RHASH_ARRAY_BOUND_RAW(h))
@@ -949,11 +946,11 @@ linear_shift(VALUE hash, st_data_t *key, st_data_t *value)
return 0;
}
-static int
+static long
linear_keys(VALUE hash, st_data_t *keys, st_index_t size)
{
uint8_t i, bound = RHASH_ARRAY_BOUND(hash);
- st_data_t *keys_start = keys, *keys_end = keys_end;
+ st_data_t *keys_start = keys, *keys_end = keys + size;
for (i = 0; i < bound; i++) {
if (keys == keys_end) {
@@ -969,7 +966,7 @@ linear_keys(VALUE hash, st_data_t *keys, st_index_t size)
return keys - keys_start;
}
-static int
+static long
linear_values(VALUE hash, st_data_t *values, st_index_t size)
{
uint8_t i, bound = RHASH_ARRAY_BOUND(hash);