From cd9ed4fdf14a40e35a0e26937e72054cc110463d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 17 Jan 2026 11:46:54 -1000 Subject: [PATCH] make fnv1a_etend --- esphome/core/helpers.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/core/helpers.h b/esphome/core/helpers.h index d08b52190c..cdc051fc90 100644 --- a/esphome/core/helpers.h +++ b/esphome/core/helpers.h @@ -397,9 +397,11 @@ constexpr uint32_t FNV1_PRIME = 16777619UL; /// Extend a FNV-1 hash with an integer (hashes each byte). template constexpr uint32_t fnv1_hash_extend(uint32_t hash, T value) { + using UnsignedT = std::make_unsigned_t; + UnsignedT uvalue = static_cast(value); for (size_t i = 0; i < sizeof(T); i++) { hash *= FNV1_PRIME; - hash ^= (value >> (i * 8)) & 0xFF; + hash ^= (uvalue >> (i * 8)) & 0xFF; } return hash; }