Home | History | Annotate | Download | only in Objects

Lines Matching refs:step

8     long        step;

12 /* Return number of items in range (lo, hi, step). step != 0
16 get_len_of_range(long lo, long hi, long step)
19 If step > 0 and lo >= hi, or step < 0 and lo <= hi, the range is empty.
20 Else for step > 0, if n values are in the range, the last one is
21 lo + (n-1)*step, which must be <= hi-1. Rearranging,
22 n <= (hi - lo - 1)/step + 1, so taking the floor of the RHS gives
28 precision to compute the RHS exactly. The analysis for step < 0
31 assert(step != 0);
32 if (step > 0 && lo < hi)
33 return 1UL + (hi - 1UL - lo) / step;
34 else if (step < 0 && lo > hi)
35 return 1UL + (lo - 1UL - hi) / (0UL - step);
41 * a (start, stop, step) triple. Used in range_repr and range_reduce.
42 * Computes start + len * step, clipped to the range [LONG_MIN, LONG_MAX].
53 the xrange, start + (len - 1) * step, which is guaranteed to lie within
54 the range of a long, and then add step to it. See the range_reverse
57 last = (long)(r->start + (unsigned long)(r->len - 1) * r->step);
58 if (r->step > 0)
59 return last > LONG_MAX - r->step ? LONG_MAX : last + r->step;
61 return last < LONG_MIN - r->step ? LONG_MIN : last + r->step;
102 obj->step = istep;
108 xrange(start, stop[, step]) -> xrange object\n\
124 return PyInt_FromLong((long)(r->start + (unsigned long)i * r->step));
138 if (r->start == 0 && r->step == 1)
142 else if (r->step == 1)
151 r->step);
162 r->step);
233 long step;
241 return PyInt_FromLong(r->start + (r->index++) * r->step);
306 it->step = ((rangeobject *)seq)->step;
315 long start, step, len;
326 step = ((rangeobject *)seq)->step;
338 If step == LONG_MIN then we still end up with LONG_MIN
343 it->start = (long)(start + (unsigned long)(len-1) * step);
344 it->step = (long)(0UL-step);