arch.h: add ARRAY_LEN

Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
1 files changed, 3 insertions(+), 1 deletions(-)

M arch.h
M arch.h +3 -1
@@ 1,5 1,5 @@ 
 /*
- * Copyright (c) 2022 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2022-2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal

          
@@ 38,6 38,8 @@ 
 #ifndef _ASM
 #define STATIC_ASSERT(c)	_Static_assert(c, #c)
 
+#define ARRAY_LEN(x)		(sizeof(x) / sizeof(x[0]))
+
 #define mmregs ((volatile struct mmregs_layout * volatile) (void *) 0x0)
 #endif