Unify to use ARRAY_SIZE in TF-M codes
ARRAY_SIZE(foo) is preferred over sizeof(foo)/sizeof(foo[0]).
Signed-off-by: Xinyu Zhang <xinyu.zhang@arm.com>
Change-Id: I6d95ceece2edc6267491923e282e28710b68ab8d
diff --git a/secure_fw/include/tfm/array.h b/secure_fw/include/tfm/array.h
new file mode 100644
index 0000000..ecf7a06
--- /dev/null
+++ b/secure_fw/include/tfm/array.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2021, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __ARRAY_H__
+#define __ARRAY_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
+#endif
+
+#ifndef IOVEC_LEN
+#define IOVEC_LEN(x) (uint32_t)ARRAY_SIZE(x)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __ARRAY_H__ */