changeset 20:8a4122caaf2f

*: redefine ARRAYSIZE on platforms that don't include it
author Paper <mrpapersonic@gmail.com>
date Tue, 19 Sep 2023 23:18:15 -0400
parents d05b1be2f3a6
children c61ce6155e92
files include/core/array.h
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/include/core/array.h	Tue Sep 19 23:10:49 2023 -0400
+++ b/include/core/array.h	Tue Sep 19 23:18:15 2023 -0400
@@ -1,7 +1,9 @@
 #ifndef __core__array_h
 #define __core__array_h
 
+#ifndef ARRAYSIZE
 #define ARRAYSIZE(x) \
-    (x / x[0])
+    (sizeof(x) / sizeof(x[0]))
+#endif
 
 #endif // __core__array_h
\ No newline at end of file