mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-16 23:17:29 +00:00
Use if constexpr in hash_struct function
This commit is contained in:
parent
6c5ea068c9
commit
786dc6ef40
@ -28,20 +28,19 @@ namespace rpcs3
|
||||
template<typename T>
|
||||
static size_t hash_struct(const T& value)
|
||||
{
|
||||
// TODO: use c++17 if constexpr
|
||||
static constexpr auto block_sz = sizeof(T);
|
||||
|
||||
if ((block_sz & 0x7) == 0)
|
||||
if constexpr ((block_sz & 0x7) == 0)
|
||||
{
|
||||
return hash_struct_base<T, u64>(value);
|
||||
}
|
||||
|
||||
if ((block_sz & 0x3) == 0)
|
||||
if constexpr ((block_sz & 0x3) == 0)
|
||||
{
|
||||
return hash_struct_base<T, u32>(value);
|
||||
}
|
||||
|
||||
if ((block_sz & 0x1) == 0)
|
||||
if constexpr ((block_sz & 0x1) == 0)
|
||||
{
|
||||
return hash_struct_base<T, u16>(value);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user