summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2010-11-08 01:04:34 -0500
committerTavian Barnes <tavianator@gmail.com>2010-11-08 01:04:34 -0500
commita9b0cc704a937015abba6094cdd14b1f2ecbb5e3 (patch)
treec9be7ed0689f720fff5d05dca48b3c71f3f5e320
parent302450a001fdadf70c8ab304d97de89de7a989c2 (diff)
downloaddimension-a9b0cc704a937015abba6094cdd14b1f2ecbb5e3.tar.xz
Optimize DMNSN_ARRAY_FOREACH_REVERSE() a bit.
-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 fa48ac0..87af84a 100644
--- a/libdimension/dimension/array.h
+++ b/libdimension/dimension/array.h
@@ -177,9 +177,9 @@ dmnsn_array_remove(dmnsn_array *array, size_t i)
i - (type)dmnsn_array_first(array) < dmnsn_array_size(array); \
++i)
-#define DMNSN_ARRAY_FOREACH_REVERSE(type, i, array) \
- for (type i = dmnsn_array_last(array); \
- (type)dmnsn_array_last(array) - i < dmnsn_array_size(array); \
+#define DMNSN_ARRAY_FOREACH_REVERSE(type, i, array) \
+ for (type i = dmnsn_array_last(array); \
+ i - (type)dmnsn_array_first(array) >= 0; \
--i)
#endif /* DIMENSION_ARRAY_H */