mirror of
https://github.com/espressif/openthread.git
synced 2026-08-14 06:37:46 +00:00
[ncp] add static assert to check size of changed set entries array (#3571)
This commit is contained in:
committed by
Jonathan Hui
parent
7494216415
commit
4219b5bb04
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "changed_props_set.hpp"
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "common/code_utils.hpp"
|
||||
|
||||
namespace ot {
|
||||
@@ -96,6 +98,9 @@ const ChangedPropsSet::Entry ChangedPropsSet::mSupportedProps[] = {
|
||||
|
||||
uint8_t ChangedPropsSet::GetNumEntries(void) const
|
||||
{
|
||||
OT_STATIC_ASSERT(OT_ARRAY_LENGTH(mSupportedProps) <= sizeof(mChangedSet) * CHAR_BIT,
|
||||
"Changed set size is smaller than number of entries in `mSupportedProps[]` array");
|
||||
|
||||
return OT_ARRAY_LENGTH(mSupportedProps);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user