Fix -Wuseless-cast in array_prefix_set::reseed
uintptr_t is already uint64_t on LP64 Linux, so the explicit cast is useless there; rely on the implicit (widening) conversion instead. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+4
-2
No files matched your search
@@ -1102,7 +1102,8 @@ class json_pointer
|
|||||||
void reseed(const void* address) noexcept
|
void reseed(const void* address) noexcept
|
||||||
{
|
{
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast): the address is only a source of entropy
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast): the address is only a source of entropy
|
||||||
std::uint64_t x = static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(address)) ^ 0x9E3779B97F4A7C15ULL;
|
std::uint64_t x = reinterpret_cast<std::uintptr_t>(address);
|
||||||
|
x ^= 0x9E3779B97F4A7C15ULL;
|
||||||
x *= 0xBF58476D1CE4E5B9ULL;
|
x *= 0xBF58476D1CE4E5B9ULL;
|
||||||
seed = x ^ (x >> 31u);
|
seed = x ^ (x >> 31u);
|
||||||
tree.reseed(seed);
|
tree.reseed(seed);
|
||||||
|
|||||||
Generated
+2
-1
@@ -27277,7 +27277,8 @@ class json_pointer
|
|||||||
void reseed(const void* address) noexcept
|
void reseed(const void* address) noexcept
|
||||||
{
|
{
|
||||||
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast): the address is only a source of entropy
|
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast): the address is only a source of entropy
|
||||||
std::uint64_t x = static_cast<std::uint64_t>(reinterpret_cast<std::uintptr_t>(address)) ^ 0x9E3779B97F4A7C15ULL;
|
std::uint64_t x = reinterpret_cast<std::uintptr_t>(address);
|
||||||
|
x ^= 0x9E3779B97F4A7C15ULL;
|
||||||
x *= 0xBF58476D1CE4E5B9ULL;
|
x *= 0xBF58476D1CE4E5B9ULL;
|
||||||
seed = x ^ (x >> 31u);
|
seed = x ^ (x >> 31u);
|
||||||
tree.reseed(seed);
|
tree.reseed(seed);
|
||||||
|
|||||||
Reference in new issue
Block a user