Skip to content

Commit

Permalink
Changed: Internal of forrange
Browse files Browse the repository at this point in the history
  • Loading branch information
zakarouf committed Nov 2, 2023
1 parent 8bd1395 commit 58942d7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/lib/forrange.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
#include "typeof.h"
#include "prep/args.h"

#define z__PRIV__forrange_5(iterator, from, upto, step, T)\
for (T iterator = (from); iterator < (upto); iterator += (step))
#define z__PRIV__forrange_5(iterator, init, upto, step, T)\
for (T iterator = (init); iterator < (upto); iterator = step)

#define z__PRIV__forrange_4(iterator, from, upto, step)\
z__PRIV__forrange_5(iterator, from, upto, step, size_t)
#define z__PRIV__forrange_4(iterator, init, upto, step)\
z__PRIV__forrange_5(iterator, init, upto, step, size_t)

#define z__PRIV__forrange_3(iterator, from, upto)\
z__PRIV__forrange_4(iterator, from, upto, 1)
#define z__PRIV__forrange_3(iterator, init, upto)\
z__PRIV__forrange_4(iterator, init, upto, (iterator + 1))

#define z__PRIV__forrange_2(iterator, upto)\
z__PRIV__forrange_3(iterator, 0, upto)
Expand All @@ -26,7 +26,7 @@

#define z__forrange(...) zpp__Args_Overload(z__PRIV__forrange_, __VA_ARGS__)
#define z__forrange_r(...) zpp__Args_Overload(z__PRIV__forrange_r_, __VA_ARGS__)
#define z__forrange_t(iterator, from, upto) z__forrange(iterator, from, upto, 1, z__typeof(from))
#define z__forrange_in(iterator, from, _len) z__forrange_t(iterator, from, from + _len)
#define z__forrange_t(iterator, init, upto)\
z__forrange(iterator, init, upto, (iterator + 1), z__typeof(init))

#endif

0 comments on commit 58942d7

Please sign in to comment.