summaryrefslogtreecommitdiffstats
path: root/libdimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-09-19 21:19:11 -0400
committerTavian Barnes <tavianator@gmail.com>2010-09-19 21:19:11 -0400
commit46bf25a9bed9eec6aaa8c4cad8144c7df629da30 (patch)
tree31ca34d4d33b99114c33d33169403e5c0b4b42a3 /libdimension
parent7ade2a55a25350a62bd075a6144282449359c8ed (diff)
downloaddimension-46bf25a9bed9eec6aaa8c4cad8144c7df629da30.tar.xz
Optimize DMNSN_ARRAY_FOREACH() a bit.
Diffstat (limited to 'libdimension')
-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 */