summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-09 17:26:01 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-01-09 17:26:29 +0900
commit23fbee0311d34da4f623a828bf0c015a90d8edc9 (patch)
treea02735201f2f5c0e7b7c9aa4626f8ae7478b596e
parent97485302db2d8c66e7f6a61e38e9d5dd32d1a8c9 (diff)
Renamed `seed` as `hash_salt`
The role of this is a so-called "salt" but not "seed", rename to get rid of confusion with other "seed" of PRNG.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2825
-rw-r--r--random.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/random.c b/random.c
index 388a3e9..85e7012 100644
--- a/random.c
+++ b/random.c
@@ -1427,33 +1427,33 @@ random_s_rand(int argc, VALUE *argv, VALUE obj)
typedef struct {
st_index_t hash;
uint8_t sip[16];
-} seed_keys_t;
+} hash_salt_t;
static union {
- seed_keys_t key;
- uint32_t u32[type_roomof(seed_keys_t, uint32_t)];
-} seed;
+ hash_salt_t key;
+ uint32_t u32[type_roomof(hash_salt_t, uint32_t)];
+} hash_salt;
static void
init_seed(struct MT *mt)
{
int i;
- for (i = 0; i < numberof(seed.u32); ++i)
- seed.u32[i] = genrand_int32(mt);
+ for (i = 0; i < numberof(hash_salt.u32); ++i)
+ hash_salt.u32[i] = genrand_int32(mt);
}
NO_SANITIZE("unsigned-integer-overflow", extern st_index_t rb_hash_start(st_index_t h));
st_index_t
rb_hash_start(st_index_t h)
{
- return st_hash_start(seed.key.hash + h);
+ return st_hash_start(hash_salt.key.hash + h);
}
st_index_t
rb_memhash(const void *ptr, long len)
{
- sip_uint64_t h = sip_hash13(seed.key.sip, ptr, len);
+ sip_uint64_t h = sip_hash13(hash_salt.key.sip, ptr, len);
#ifdef HAVE_UINT64_T
return (st_index_t)h;
#else