mirror of
https://github.com/espressif/openthread.git
synced 2026-07-31 08:07:47 +00:00
[core] use NumericLimits<> constants (#9875)
Use `NumericLimits<UintType>::kMax` constants in core files.
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
#include "common/locator_getters.hpp"
|
||||
#include "common/log.hpp"
|
||||
#include "common/num_utils.hpp"
|
||||
#include "common/numeric_limits.hpp"
|
||||
#include "common/random.hpp"
|
||||
#include "instance/instance.hpp"
|
||||
#include "thread/mle_types.hpp"
|
||||
@@ -202,7 +203,7 @@ void Manager::HandleMulticastListenerRegistration(const Coap::Message &aMessage,
|
||||
}
|
||||
else
|
||||
{
|
||||
VerifyOrExit(timeout < UINT32_MAX, status = ThreadStatusTlv::kMlrNoPersistent);
|
||||
VerifyOrExit(timeout < NumericLimits<uint32_t>::kMax, status = ThreadStatusTlv::kMlrNoPersistent);
|
||||
|
||||
if (timeout != 0)
|
||||
{
|
||||
|
||||
@@ -37,11 +37,12 @@
|
||||
#include "openthread-core-config.h"
|
||||
|
||||
#include <openthread/radio_stats.h>
|
||||
#include <openthread/platform/crypto.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
|
||||
#include <openthread/platform/crypto.h>
|
||||
#include "common/locator.hpp"
|
||||
#include "common/non_copyable.hpp"
|
||||
#include "common/numeric_limits.hpp"
|
||||
#include "common/time.hpp"
|
||||
#include "mac/mac_frame.hpp"
|
||||
|
||||
@@ -1082,9 +1083,9 @@ inline Error Radio::ResetCsl(void) { return kErrorNotImplemented; }
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
|
||||
inline uint8_t Radio::GetCslAccuracy(void) { return UINT8_MAX; }
|
||||
inline uint8_t Radio::GetCslAccuracy(void) { return NumericLimits<uint8_t>::kMax; }
|
||||
|
||||
inline uint8_t Radio::GetCslUncertainty(void) { return UINT8_MAX; }
|
||||
inline uint8_t Radio::GetCslUncertainty(void) { return NumericLimits<uint8_t>::kMax; }
|
||||
#endif
|
||||
|
||||
inline Mac::TxFrame &Radio::GetTransmitBuffer(void)
|
||||
|
||||
@@ -261,14 +261,14 @@ OT_TOOL_WEAK uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return UINT8_MAX;
|
||||
return NumericLimits<uint8_t>::kMax;
|
||||
}
|
||||
|
||||
OT_TOOL_WEAK uint8_t otPlatRadioGetCslUncertainty(otInstance *aInstance)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
|
||||
return UINT8_MAX;
|
||||
return NumericLimits<uint8_t>::kMax;
|
||||
}
|
||||
|
||||
OT_TOOL_WEAK otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain)
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "common/code_utils.hpp"
|
||||
#include "common/locator_getters.hpp"
|
||||
#include "common/num_utils.hpp"
|
||||
#include "common/numeric_limits.hpp"
|
||||
#include "instance/instance.hpp"
|
||||
|
||||
namespace ot {
|
||||
@@ -118,7 +119,7 @@ void LqiAverager::Add(uint8_t aLqi)
|
||||
{
|
||||
uint8_t count;
|
||||
|
||||
if (mCount < UINT8_MAX)
|
||||
if (mCount < NumericLimits<uint8_t>::kMax)
|
||||
{
|
||||
mCount++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user