From abc05301ab448eaee0194fea0f4cd4241ce9800a Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Wed, 11 Nov 2026 22:23:14 +0100 Subject: [PATCH] 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 --- include/nlohmann/detail/json_pointer.hpp | 3 ++- single_include/nlohmann/json.hpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/json_pointer.hpp b/include/nlohmann/detail/json_pointer.hpp index cf2689a40..a09f1c433 100644 --- a/include/nlohmann/detail/json_pointer.hpp +++ b/include/nlohmann/detail/json_pointer.hpp @@ -1102,7 +1102,8 @@ class json_pointer void reseed(const void* address) noexcept { // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast): the address is only a source of entropy - std::uint64_t x = static_cast(reinterpret_cast(address)) ^ 0x9E3779B97F4A7C15ULL; + std::uint64_t x = reinterpret_cast(address); + x ^= 0x9E3779B97F4A7C15ULL; x *= 0xBF58476D1CE4E5B9ULL; seed = x ^ (x >> 31u); tree.reseed(seed); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 5b3003734..84332139c 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -27277,7 +27277,8 @@ class json_pointer void reseed(const void* address) noexcept { // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast): the address is only a source of entropy - std::uint64_t x = static_cast(reinterpret_cast(address)) ^ 0x9E3779B97F4A7C15ULL; + std::uint64_t x = reinterpret_cast(address); + x ^= 0x9E3779B97F4A7C15ULL; x *= 0xBF58476D1CE4E5B9ULL; seed = x ^ (x >> 31u); tree.reseed(seed);