diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /util/digest/fnv.h | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/digest/fnv.h')
-rw-r--r-- | util/digest/fnv.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/util/digest/fnv.h b/util/digest/fnv.h index 87b41a3de7..957ba9b9f1 100644 --- a/util/digest/fnv.h +++ b/util/digest/fnv.h @@ -9,7 +9,7 @@ namespace NFnvPrivate { template <class It> - constexpr ui32 FnvHash32(It b, It e, ui32 init) { + constexpr ui32 FnvHash32(It b, It e, ui32 init) { while (b != e) { init = (init * FNV32PRIME) ^ (unsigned char)*b++; } @@ -18,7 +18,7 @@ namespace NFnvPrivate { } template <class It> - constexpr ui64 FnvHash64(It b, It e, ui64 init) { + constexpr ui64 FnvHash64(It b, It e, ui64 init) { while (b != e) { init = (init * FNV64PRIME) ^ (unsigned char)*b++; } @@ -34,7 +34,7 @@ namespace NFnvPrivate { struct TFnvHelper<t> { \ static const ui##t Init = FNV##t##INIT; \ template <class It> \ - static constexpr ui##t FnvHash(It b, It e, ui##t init) { \ + static constexpr ui##t FnvHash(It b, It e, ui##t init) { \ return FnvHash##t(b, e, init); \ } \ }; @@ -46,28 +46,28 @@ namespace NFnvPrivate { } template <class T, class It> -static constexpr T FnvHash(It b, It e, T init) { +static constexpr T FnvHash(It b, It e, T init) { static_assert(sizeof(*b) == 1, "expect sizeof(*b) == 1"); return (T)NFnvPrivate::TFnvHelper<8 * sizeof(T)>::FnvHash(b, e, init); } template <class T, class It> -static constexpr T FnvHash(It b, It e) { +static constexpr T FnvHash(It b, It e) { return FnvHash<T>(b, e, (T)NFnvPrivate::TFnvHelper<8 * sizeof(T)>::Init); } template <class T> -static constexpr T FnvHash(const void* buf, size_t len, T init) { +static constexpr T FnvHash(const void* buf, size_t len, T init) { return FnvHash<T>((const unsigned char*)buf, (const unsigned char*)buf + len, init); } template <class T> -static constexpr T FnvHash(const void* buf, size_t len) { +static constexpr T FnvHash(const void* buf, size_t len) { return FnvHash<T>((const unsigned char*)buf, (const unsigned char*)buf + len); } template <class T, class Buf> -static constexpr T FnvHash(const Buf& buf) { +static constexpr T FnvHash(const Buf& buf) { return FnvHash<T>(buf.data(), buf.size() * sizeof(*buf.data())); } |