summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libdimension/dimension/array.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/libdimension/dimension/array.h b/libdimension/dimension/array.h
index 022beb9..fd78deb 100644
--- a/libdimension/dimension/array.h
+++ b/libdimension/dimension/array.h
@@ -171,9 +171,9 @@ dmnsn_array_remove(dmnsn_array *array, size_t i)
}
/* Macro to shorten array iteration */
-#define DMNSN_ARRAY_FOREACH(type, i, array) \
- for (type i = dmnsn_array_first(array); \
- i <= (type)dmnsn_array_last(array); \
+#define DMNSN_ARRAY_FOREACH(type, i, array) \
+ for (type i = dmnsn_array_first(array); \
+ i - (type)dmnsn_array_first(array) < dmnsn_array_size(array); \
++i)
#endif /* DIMENSION_ARRAY_H */