Skip to content

Commit 57e40e3

Browse files
author
Julian LALU
committed
Fix constexpr i128
1 parent e44aa9e commit 57e40e3

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

interface/core/hash/city_hash.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ namespace hud::hash_algorithm
406406
constexpr u64 combine_64(u64 a, u64 b) noexcept
407407
{
408408
// From abseil 64 bit hash mix
409-
static constexpr u64 kMul = sizeof(size_t) == 4 ? u64 {0xcc9e2d51} : u64 {0x9ddfea08eb382d69};
409+
constexpr const u64 kMul = sizeof(usize) == 4 ? u64 {0xcc9e2d51} : u64 {0x9ddfea08eb382d69};
410410
using MulResultType = hud::conditional_t<sizeof(uptr) == 4, u64, ::u128>;
411411
// We do the addition in 64-bit space to make sure the 128-bit
412412
// multiplication is fast. If we were to do it as MultType the compiler has

interface/core/i128/i128_portable.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ namespace hud
690690
}
691691

692692
/** Multiply this to other and return this. */
693-
u128_portable &operator*=(u128_portable other) noexcept
693+
constexpr u128_portable &operator*=(u128_portable other) noexcept
694694
{
695695
*this = *this * other;
696696
return *this;
@@ -706,7 +706,7 @@ namespace hud
706706
}
707707

708708
/** Divide this to other and return this. */
709-
u128_portable &operator/=(u128_portable other) noexcept
709+
constexpr u128_portable &operator/=(u128_portable other) noexcept
710710
{
711711
*this = *this / other;
712712
return *this;
@@ -722,7 +722,7 @@ namespace hud
722722
}
723723

724724
/** Retrieves the remainder of this divided by other, result in this and returns this. */
725-
u128_portable &operator%=(u128_portable other) noexcept
725+
constexpr u128_portable &operator%=(u128_portable other) noexcept
726726
{
727727
*this = *this % other;
728728
return *this;
@@ -841,7 +841,7 @@ namespace hud
841841
}
842842

843843
/** Right shift this and return the result */
844-
const u128_portable operator>>(i32 amount) const noexcept
844+
constexpr const u128_portable operator>>(i32 amount) const noexcept
845845
{
846846
// uint64_t shifts of >= 64 are undefined, so we will need some
847847
// special-casing.

0 commit comments

Comments
 (0)