Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
lpbeliveau-silabs and bzbarsky-apple authored Aug 28, 2024
1 parent 90daf92 commit 90dc9a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/clusters/scenes-server/SceneHandlerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ template <typename Type>
typename app::NumericAttributeTraits<Type>::WorkingType
ConvertDefaultValueToWorkingValue(const EmberAfDefaultAttributeValue & defaultValue)
{
if (sizeof(typename app::NumericAttributeTraits<Type>::WorkingType) <= 2)
if constexpr (sizeof(typename app::NumericAttributeTraits<Type>::WorkingType) <= 2)
{
return static_cast<typename app::NumericAttributeTraits<Type>::WorkingType>(defaultValue.defaultValue);
}
Expand All @@ -48,10 +48,10 @@ ConvertDefaultValueToWorkingValue(const EmberAfDefaultAttributeValue & defaultVa
}

/// IsOnlyOneValuePopulated
/// @brief Helper function to verify if only one value is populated in a given AttributeValuePairType
/// @brief Helper function to verify that exactly one value is populated in a given AttributeValuePairType
/// @param AttributeValuePairType & type AttributeValuePairType to verify
/// @return bool true if only one value is populated, false otherwise
bool IsOnlyOneValuePopulated(const AttributeValuePairType & type)
bool IsExactlyOneValuePopulated(const AttributeValuePairType & type)
{
int count = 0;
if (type.valueUnsigned8.HasValue())
Expand Down Expand Up @@ -80,7 +80,7 @@ bool IsOnlyOneValuePopulated(const AttributeValuePairType & type)
/// @param[in] metadata EmberAfAttributeMetadata
///
template <typename Type>
void CapAttributeID(typename app::NumericAttributeTraits<Type>::WorkingType & Value, const EmberAfAttributeMetadata * metadata)
void CapAttributeValue(typename app::NumericAttributeTraits<Type>::WorkingType & value, const EmberAfAttributeMetadata * metadata)
{
using IntType = app::NumericAttributeTraits<Type>;
using WorkingType = typename IntType::WorkingType;
Expand All @@ -89,7 +89,7 @@ void CapAttributeID(typename app::NumericAttributeTraits<Type>::WorkingType & Va
WorkingType minValue;
uint16_t bitWidth = static_cast<uint16_t>(emberAfAttributeSize(metadata) * 8);

// Min/Max Value capps for the OddSize integers
// Min/Max Value caps for the OddSize integers
if (metadata->IsSignedIntegerAttribute())
{
// We use emberAfAttributeSize for cases like INT24S, INT40S, INT48S, INT56S where numeric_limits<WorkingType>::max()
Expand Down

0 comments on commit 90dc9a6

Please sign in to comment.