From eb671b2a6d884e6b2ee84c5b528277d494fbc144 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Wed, 27 May 2026 13:24:56 -0700 Subject: [PATCH] [bit-set] cast bitwise NOT in FlipBits to uint8_t (#13164) Explicitly cast the result of the bitwise NOT operator ~ to uint8_t in BitSetUtils::FlipBits to resolve a build error under AppleClang. In C++, using the bitwise NOT operator on a uint8_t value promotes it to an int. Assigning the promoted int back to uint8_t triggers an implicit conversion warning/error (-Wimplicit-int-conversion) under newer compiler versions, which fails the build when compiled with -Werror. --- src/core/common/bit_set.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/common/bit_set.cpp b/src/core/common/bit_set.cpp index 681a11a1a..06f244f14 100644 --- a/src/core/common/bit_set.cpp +++ b/src/core/common/bit_set.cpp @@ -67,7 +67,7 @@ void BitSetUtils::FlipBits(uint8_t *aTargetMask, uint16_t aSize, uint16_t aNumBi { for (uint16_t i = 0; i < aSize; i++) { - aTargetMask[i] = ~aTargetMask[i]; + aTargetMask[i] = static_cast(~aTargetMask[i]); } Tidy(aTargetMask, aSize, aNumBits); @@ -106,7 +106,7 @@ void BitSetUtils::Subtract(uint8_t *aTargetMask, const uint8_t *aMask, uint16_t { for (uint16_t i = 0; i < aSize; i++) { - aTargetMask[i] &= (~aMask[i]); + aTargetMask[i] &= static_cast(~aMask[i]); } }