diff options
author | shadchin <shadchin@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:30 +0300 |
commit | 2598ef1d0aee359b4b6d5fdd1758916d5907d04f (patch) | |
tree | 012bb94d777798f1f56ac1cec429509766d05181 /contrib/tools/python3/src/Python/pyhash.c | |
parent | 6751af0b0c1b952fede40b19b71da8025b5d8bcf (diff) | |
download | ydb-2598ef1d0aee359b4b6d5fdd1758916d5907d04f.tar.gz |
Restoring authorship annotation for <shadchin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Python/pyhash.c')
-rw-r--r-- | contrib/tools/python3/src/Python/pyhash.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/contrib/tools/python3/src/Python/pyhash.c b/contrib/tools/python3/src/Python/pyhash.c index 3843079fbb..674471aadd 100644 --- a/contrib/tools/python3/src/Python/pyhash.c +++ b/contrib/tools/python3/src/Python/pyhash.c @@ -129,22 +129,22 @@ _Py_HashDouble(double v) } Py_hash_t -_Py_HashPointerRaw(const void *p) +_Py_HashPointerRaw(const void *p) { size_t y = (size_t)p; /* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid excessive hash collisions for dicts and sets */ y = (y >> 4) | (y << (8 * SIZEOF_VOID_P - 4)); - return (Py_hash_t)y; -} - -Py_hash_t -_Py_HashPointer(const void *p) -{ - Py_hash_t x = _Py_HashPointerRaw(p); - if (x == -1) { + return (Py_hash_t)y; +} + +Py_hash_t +_Py_HashPointer(const void *p) +{ + Py_hash_t x = _Py_HashPointerRaw(p); + if (x == -1) { x = -2; - } + } return x; } @@ -372,7 +372,7 @@ static PyHash_FuncDef PyHash_Func = {fnv, "fnv", 8 * SIZEOF_PY_HASH_T, static uint64_t siphash24(uint64_t k0, uint64_t k1, const void *src, Py_ssize_t src_sz) { uint64_t b = (uint64_t)src_sz << 56; - const uint8_t *in = (const uint8_t*)src; + const uint8_t *in = (const uint8_t*)src; uint64_t v0 = k0 ^ 0x736f6d6570736575ULL; uint64_t v1 = k1 ^ 0x646f72616e646f6dULL; @@ -426,13 +426,13 @@ _Py_KeyedHash(uint64_t key, const void *src, Py_ssize_t src_sz) #if Py_HASH_ALGORITHM == Py_HASH_SIPHASH24 -static Py_hash_t -pysiphash(const void *src, Py_ssize_t src_sz) { - return (Py_hash_t)siphash24( - _le64toh(_Py_HashSecret.siphash.k0), _le64toh(_Py_HashSecret.siphash.k1), - src, src_sz); -} - +static Py_hash_t +pysiphash(const void *src, Py_ssize_t src_sz) { + return (Py_hash_t)siphash24( + _le64toh(_Py_HashSecret.siphash.k0), _le64toh(_Py_HashSecret.siphash.k1), + src, src_sz); +} + static PyHash_FuncDef PyHash_Func = {pysiphash, "siphash24", 64, 128}; #endif |