mirror of
https://github.com/zeek/zeek.git
synced 2025-10-03 23:28:20 +00:00
Simplify type trait usage (remove ::value usage)
This commit is contained in:
parent
cd7ebdb2ed
commit
4957dace64
3 changed files with 9 additions and 10 deletions
13
src/Hash.cc
13
src/Hash.cc
|
@ -27,20 +27,19 @@ alignas(16) unsigned long long KeyedHash::shared_siphash_key[2];
|
|||
|
||||
// we use the following lines to not pull in the highwayhash headers in Hash.h - but to check the
|
||||
// types did not change underneath us.
|
||||
static_assert(std::is_same<hash64_t, highwayhash::HHResult64>::value,
|
||||
static_assert(std::is_same_v<hash64_t, highwayhash::HHResult64>,
|
||||
"Highwayhash return values must match hash_x_t");
|
||||
static_assert(std::is_same<hash128_t, highwayhash::HHResult128>::value,
|
||||
static_assert(std::is_same_v<hash128_t, highwayhash::HHResult128>,
|
||||
"Highwayhash return values must match hash_x_t");
|
||||
static_assert(std::is_same<hash256_t, highwayhash::HHResult256>::value,
|
||||
static_assert(std::is_same_v<hash256_t, highwayhash::HHResult256>,
|
||||
"Highwayhash return values must match hash_x_t");
|
||||
|
||||
void KeyedHash::InitializeSeeds(const std::array<uint32_t, SEED_INIT_SIZE>& seed_data)
|
||||
{
|
||||
static_assert(std::is_same<decltype(KeyedHash::shared_siphash_key),
|
||||
highwayhash::SipHashState::Key>::value,
|
||||
"Highwayhash Key is not unsigned long long[2]");
|
||||
static_assert(
|
||||
std::is_same<decltype(KeyedHash::shared_highwayhash_key), highwayhash::HHKey>::value,
|
||||
std::is_same_v<decltype(KeyedHash::shared_siphash_key), highwayhash::SipHashState::Key>,
|
||||
"Highwayhash Key is not unsigned long long[2]");
|
||||
static_assert(std::is_same_v<decltype(KeyedHash::shared_highwayhash_key), highwayhash::HHKey>,
|
||||
"Highwayhash HHKey is not uint64_t[4]");
|
||||
if ( seeds_initialized )
|
||||
return;
|
||||
|
|
|
@ -108,7 +108,7 @@ UHF::UHF(Hasher::seed_t arg_seed)
|
|||
// times.
|
||||
Hasher::digest UHF::hash(const void* x, size_t n) const
|
||||
{
|
||||
static_assert(std::is_same<highwayhash::SipHashState::Key, decltype(seed.h)>::value,
|
||||
static_assert(std::is_same_v<highwayhash::SipHashState::Key, decltype(seed.h)>,
|
||||
"Seed value is not the same type as highwayhash key");
|
||||
return highwayhash::SipHash(seed.h, reinterpret_cast<const char*>(x), n);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ void BasicThread::SetName(const char* arg_name)
|
|||
void BasicThread::SetOSName(const char* arg_name)
|
||||
{
|
||||
// Do it only if libc++ supports pthread_t.
|
||||
if constexpr ( std::is_same<std::thread::native_handle_type, pthread_t>::value )
|
||||
if constexpr ( std::is_same_v<std::thread::native_handle_type, pthread_t> )
|
||||
zeek::util::detail::set_thread_name(arg_name,
|
||||
reinterpret_cast<pthread_t>(thread.native_handle()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue