/external/python/cpython3/Include/ |
D | sliceobject.h | 48 #define PySlice_GetIndicesEx(slice, length, start, stop, step, slicelen) ( \ argument 50 ((*(slicelen) = 0), -1) : \ 51 ((*(slicelen) = PySlice_AdjustIndices((length), (start), (stop), *(step))), \
|
/external/python/cpython3/Modules/ |
D | mmapmodule.c | 779 Py_ssize_t start, stop, step, slicelen; in mmap_subscript() local 784 slicelen = PySlice_AdjustIndices(self->size, &start, &stop, step); in mmap_subscript() 786 if (slicelen <= 0) in mmap_subscript() 790 slicelen); in mmap_subscript() 792 char *result_buf = (char *)PyMem_Malloc(slicelen); in mmap_subscript() 798 for (cur = start, i = 0; i < slicelen; in mmap_subscript() 803 slicelen); in mmap_subscript() 886 Py_ssize_t start, stop, step, slicelen; in mmap_ass_subscript() local 892 slicelen = PySlice_AdjustIndices(self->size, &start, &stop, step); in mmap_ass_subscript() 900 if (vbuf.len != slicelen) { in mmap_ass_subscript() [all …]
|
D | _elementtree.c | 1774 Py_ssize_t start, stop, step, slicelen, cur, i; in element_subscr() local 1783 slicelen = PySlice_AdjustIndices(self->extra->length, &start, &stop, in element_subscr() 1786 if (slicelen <= 0) in element_subscr() 1789 list = PyList_New(slicelen); in element_subscr() 1793 for (cur = start, i = 0; i < slicelen; in element_subscr() 1826 Py_ssize_t start, stop, step, slicelen, newlen, cur, i; in element_ass_subscr() local 1839 slicelen = PySlice_AdjustIndices(self->extra->length, &start, &stop, in element_ass_subscr() 1847 if (slicelen <= 0) in element_ass_subscr() 1855 start = stop + step * (slicelen - 1) - 1; in element_ass_subscr() 1859 assert((size_t)slicelen <= SIZE_MAX / sizeof(PyObject *)); in element_ass_subscr() [all …]
|
/external/python/cpython2/Modules/ |
D | mmapmodule.c | 785 Py_ssize_t start, stop, step, slicelen; in mmap_subscript() local 790 slicelen = _PySlice_AdjustIndices(self->size, &start, &stop, step); in mmap_subscript() 792 if (slicelen <= 0) in mmap_subscript() 796 slicelen); in mmap_subscript() 798 char *result_buf = (char *)PyMem_Malloc(slicelen); in mmap_subscript() 804 for (cur = start, i = 0; i < slicelen; in mmap_subscript() 809 slicelen); in mmap_subscript() 922 Py_ssize_t start, stop, step, slicelen; in mmap_ass_subscript() local 927 slicelen = _PySlice_AdjustIndices(self->size, &start, &stop, step); in mmap_ass_subscript() 938 if (PyString_Size(value) != slicelen) { in mmap_ass_subscript() [all …]
|
D | _elementtree.c | 1365 Py_ssize_t start, stop, step, slicelen, cur, i; local 1374 slicelen = _PySlice_AdjustIndices(self->extra->length, &start, &stop, 1377 if (slicelen <= 0) 1380 list = PyList_New(slicelen); 1384 for (cur = start, i = 0; i < slicelen; 1422 Py_ssize_t start, stop, step, slicelen, newlen, cur, i; local 1433 slicelen = _PySlice_AdjustIndices(self->extra->length, &start, &stop, 1435 assert(slicelen <= self->extra->length); 1451 if (step != 1 && newlen != slicelen) 1458 (int)newlen, (int)slicelen [all …]
|
/external/python/cpython2/Objects/ |
D | structseq.c | 114 Py_ssize_t start, stop, step, slicelen, cur, i; in structseq_subscript() local 120 slicelen = _PySlice_AdjustIndices(VISIBLE_SIZE(self), &start, &stop, in structseq_subscript() 122 if (slicelen <= 0) in structseq_subscript() 124 result = PyTuple_New(slicelen); in structseq_subscript() 127 for (cur = start, i = 0; i < slicelen; in structseq_subscript()
|
D | bytearrayobject.c | 610 Py_ssize_t start, stop, step, slicelen, needed; in bytearray_ass_subscript() local 632 slicelen = 1; in bytearray_ass_subscript() 646 slicelen = _PySlice_AdjustIndices(PyByteArray_GET_SIZE(self), &start, in bytearray_ass_subscript() 684 if (slicelen != needed) { in bytearray_ass_subscript() 687 if (slicelen > needed) { in bytearray_ass_subscript() 698 Py_SIZE(self) + needed - slicelen) < 0) in bytearray_ass_subscript() 700 if (slicelen < needed) { in bytearray_ass_subscript() 727 start = stop + step * (slicelen - 1) - 1; in bytearray_ass_subscript() 731 i < slicelen; cur += step, i++) { in bytearray_ass_subscript() 741 cur = start + slicelen*step; in bytearray_ass_subscript() [all …]
|
/external/python/cpython3/Objects/ |
D | bytearrayobject.c | 621 Py_ssize_t start, stop, step, slicelen, needed; in bytearray_ass_subscript() local 644 slicelen = 1; in bytearray_ass_subscript() 658 slicelen = PySlice_AdjustIndices(PyByteArray_GET_SIZE(self), &start, in bytearray_ass_subscript() 709 if (slicelen == 0) in bytearray_ass_subscript() 715 start = stop + step * (slicelen - 1) - 1; in bytearray_ass_subscript() 719 i < slicelen; cur += step, i++) { in bytearray_ass_subscript() 729 cur = start + (size_t)slicelen*step; in bytearray_ass_subscript() 731 memmove(buf + cur - slicelen, in bytearray_ass_subscript() 736 PyByteArray_GET_SIZE(self) - slicelen) < 0) in bytearray_ass_subscript() 746 if (needed != slicelen) { in bytearray_ass_subscript() [all …]
|
/external/python/cpython3/Modules/_ctypes/ |
D | _ctypes.c | 4373 Py_ssize_t start, stop, step, slicelen, cur, i; in Array_subscript() local 4378 slicelen = PySlice_AdjustIndices(self->b_length, &start, &stop, step); in Array_subscript() 4391 if (slicelen <= 0) in Array_subscript() 4395 slicelen); in Array_subscript() 4397 dest = (char *)PyMem_Malloc(slicelen); in Array_subscript() 4402 for (cur = start, i = 0; i < slicelen; in Array_subscript() 4407 np = PyBytes_FromStringAndSize(dest, slicelen); in Array_subscript() 4416 if (slicelen <= 0) in Array_subscript() 4420 slicelen); in Array_subscript() 4423 dest = PyMem_New(wchar_t, slicelen); in Array_subscript() [all …]
|
/external/python/cpython2/Modules/_ctypes/ |
D | _ctypes.c | 4532 Py_ssize_t start, stop, step, slicelen, cur, i; in Array_subscript() local 4545 slicelen = _PySlice_AdjustIndices(self->b_length, &start, &stop, step); in Array_subscript() 4550 if (slicelen <= 0) in Array_subscript() 4554 slicelen); in Array_subscript() 4556 dest = (char *)PyMem_Malloc(slicelen); in Array_subscript() 4561 for (cur = start, i = 0; i < slicelen; in Array_subscript() 4566 np = PyString_FromStringAndSize(dest, slicelen); in Array_subscript() 4575 if (slicelen <= 0) in Array_subscript() 4579 slicelen); in Array_subscript() 4582 dest = PyMem_New(wchar_t, slicelen); in Array_subscript() [all …]
|
/external/python/cpython3/Lib/test/ |
D | test_buffer.py | 543 def randslice_from_slicelen(slicelen, listlen): argument 545 maxstart = listlen - slicelen 547 maxstep = (listlen - start) // slicelen if slicelen else 1 549 stop = start + slicelen * step 552 if control != slicelen: 563 slicelen = randrange(1, l+1) if l > 0 else 0 564 lslices[n] = randslice_from_slicelen(slicelen, l) 565 rslices[n] = randslice_from_slicelen(slicelen, l) 595 _, _, _, slicelen = slice_indices(s_small, small) 597 slicelen = randrange(1, small+1) if small > 0 else 0 [all …]
|