• Home
  • Raw
  • Download

Lines Matching refs:step

19     PyObject *step;  member
29 validate_step(PyObject *step) in validate_step() argument
32 if (!step) in validate_step()
35 step = PyNumber_Index(step); in validate_step()
36 if (step && _PyLong_Sign(step) == 0) { in validate_step()
39 Py_CLEAR(step); in validate_step()
42 return step; in validate_step()
46 compute_range_length(PyObject *start, PyObject *stop, PyObject *step);
50 PyObject *stop, PyObject *step) in make_range_object() argument
54 length = compute_range_length(start, stop, step); in make_range_object()
65 obj->step = step; in make_range_object()
79 PyObject *start = NULL, *stop = NULL, *step = NULL; in range_from_array() local
83 step = args[2]; in range_from_array()
96 step = validate_step(step); /* Caution, this can clear exceptions */ in range_from_array()
97 if (!step) { in range_from_array()
111 step = _PyLong_One; in range_from_array()
123 obj = make_range_object(type, start, stop, step); in range_from_array()
131 Py_DECREF(step); in range_from_array()
171 Py_DECREF(r->step); in range_dealloc()
181 compute_range_length(PyObject *start, PyObject *stop, PyObject *step) in compute_range_length() argument
193 cmp_result = PyObject_RichCompareBool(step, _PyLong_Zero, Py_GT); in compute_range_length()
200 Py_INCREF(step); in compute_range_length()
204 step = PyNumber_Negative(step); in compute_range_length()
205 if (!step) in compute_range_length()
212 Py_DECREF(step); in compute_range_length()
224 if ((tmp2 = PyNumber_FloorDivide(diff, step)) == NULL) in compute_range_length()
232 Py_DECREF(step); in compute_range_length()
237 Py_DECREF(step); in compute_range_length()
257 incr = PyNumber_Multiply(i, r->step); in compute_item()
334 PyObject *start = NULL, *stop = NULL, *step = NULL; in compute_slice() local
338 error = _PySlice_GetLongIndices(slice, r->length, &start, &stop, &step); in compute_slice()
342 substep = PyNumber_Multiply(r->step, step); in compute_slice()
344 Py_CLEAR(step); in compute_slice()
361 Py_XDECREF(step); in compute_slice()
379 cmp1 = PyObject_RichCompareBool(r->step, _PyLong_Zero, Py_GT); in range_contains_long()
402 tmp2 = PyNumber_Remainder(tmp1, r->step); in range_contains_long()
461 return PyObject_RichCompareBool(r0->step, r1->step, Py_EQ); in range_equals()
534 Py_INCREF(r->step); in range_hash()
535 PyTuple_SET_ITEM(t, 2, r->step); in range_hash()
583 idx = PyNumber_FloorDivide(tmp, r->step); in range_index()
611 istep = PyNumber_AsSsize_t(r->step, NULL); in range_repr()
621 r->start, r->stop, r->step); in range_repr()
629 r->start, r->stop, r->step); in range_reduce()
694 {"step", T_OBJECT_EX, offsetof(rangeobject, step), READONLY},
751 long step; member
762 (unsigned long)(r->index++) * r->step)); in rangeiter_next()
778 PyObject *start=NULL, *stop=NULL, *step=NULL; in rangeiter_reduce() local
785 stop = PyLong_FromLong(r->start + r->len * r->step); in rangeiter_reduce()
788 step = PyLong_FromLong(r->step); in rangeiter_reduce()
789 if (step == NULL) in rangeiter_reduce()
792 start, stop, step); in rangeiter_reduce()
801 Py_XDECREF(step); in rangeiter_reduce()
870 get_len_of_range(long lo, long hi, long step) in get_len_of_range() argument
885 assert(step != 0); in get_len_of_range()
886 if (step > 0 && lo < hi) in get_len_of_range()
887 return 1UL + (hi - 1UL - lo) / step; in get_len_of_range()
888 else if (step < 0 && lo > hi) in get_len_of_range()
889 return 1UL + (lo - 1UL - hi) / (0UL - step); in get_len_of_range()
898 fast_range_iter(long start, long stop, long step) in fast_range_iter() argument
905 it->step = step; in fast_range_iter()
906 ulen = get_len_of_range(start, stop, step); in fast_range_iter()
922 PyObject *step; member
939 product = PyNumber_Multiply(r->len, r->step); in longrangeiter_reduce()
947 Py_INCREF(r->step); in longrangeiter_reduce()
949 r->start, stop, r->step); in longrangeiter_reduce()
953 Py_DECREF(r->step); in longrangeiter_reduce()
1001 Py_XDECREF(r->step); in longrangeiter_dealloc()
1017 product = PyNumber_Multiply(r->index, r->step); in longrangeiter_next()
1090 lstep = PyLong_AsLong(r->step); in range_iter()
1108 it->step = r->step; in range_iter()
1112 Py_INCREF(it->step); in range_iter()
1149 lstep = PyLong_AsLong(range->step); in range_reverse()
1192 it->index = it->start = it->step = NULL; in range_reverse()
1202 product = PyNumber_Multiply(diff, range->step); in range_reverse()
1213 it->step = PyNumber_Negative(range->step); in range_reverse()
1214 if (!it->step) in range_reverse()