changeset 2207:9f901b4004b8

* include/cyg_type.h: #define CYG_NELEM to calculate the number of elements in a (statically allocated) array.
author asl
date Fri, 19 May 2006 10:14:07 +0000
parents 7681e8acc4cd
children 0c3488465ccf
files packages/infra/current/ChangeLog packages/infra/current/include/cyg_type.h
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/packages/infra/current/ChangeLog
+++ b/packages/infra/current/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-17  David Vrabel <dvrabel@arcom.com>
+ 
+	* include/cyg_type.h: #define CYG_NELEM to calculate the
+ 	number of elements in a (statically allocated) array.
+ 
 2006-05-08  Sergei Gavrikov <sg@belvok.com>
 	
 	* src/buffer.cxx: Fix the compiler warnings.
--- a/packages/infra/current/include/cyg_type.h
+++ b/packages/infra/current/include/cyg_type.h
@@ -251,6 +251,11 @@ typedef cyg_haladdress  CYG_ADDRESS;
 typedef cyg_haladdrword CYG_ADDRWORD;
 
 // -------------------------------------------------------------------------
+// Number of elements in a (statically allocated) array.
+
+#define CYG_NELEM(a) (sizeof(a) / sizeof((a)[0]))
+
+// -------------------------------------------------------------------------
 // Constructor ordering macros.  These are added as annotations to all
 // static objects to order the constuctors appropriately.