From 4515bd9e6081e4e4d8882a35bb67e7ec2a621fe1 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Sun, 2 Mar 2025 18:09:08 +0100 Subject: [PATCH] utils: added macro to retrieve the number of elements of an array --- openrtx/include/core/utils.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openrtx/include/core/utils.h b/openrtx/include/core/utils.h index 08dee873..e2cd6af2 100644 --- a/openrtx/include/core/utils.h +++ b/openrtx/include/core/utils.h @@ -28,6 +28,14 @@ extern "C" { #endif +/** + * Get the number of elements of an array. + * + * @param x: array. + * @return number of elements. + */ +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) + /** * This function allows to obtain the value of a given calibration parameter for * frequencies outside the calibration points. It works by searching the two