diff options
author | Tavian Barnes <tavianator@gmail.com> | 2010-09-19 21:19:11 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@gmail.com> | 2010-09-19 21:19:11 -0400 |
commit | 46bf25a9bed9eec6aaa8c4cad8144c7df629da30 (patch) | |
tree | 31ca34d4d33b99114c33d33169403e5c0b4b42a3 /libdimension/dimension | |
parent | 7ade2a55a25350a62bd075a6144282449359c8ed (diff) | |
download | dimension-46bf25a9bed9eec6aaa8c4cad8144c7df629da30.tar.xz |
Optimize DMNSN_ARRAY_FOREACH() a bit.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r-- | libdimension/dimension/array.h | 6 |
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 */ |