Skip to content

Commit

Permalink
better naming
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanschnell committed Feb 19, 2022
1 parent 0f39cc2 commit 5c136d6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bitarray/_bitarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ Return a copy of the bitarray.");


static Py_ssize_t
get_slicelength(Py_ssize_t start, Py_ssize_t stop, Py_ssize_t step)
calc_slicelength(Py_ssize_t start, Py_ssize_t stop, Py_ssize_t step)
{
assert(step != 0);
if (step < 0) {
Expand All @@ -968,7 +968,7 @@ static void
make_step_positive(Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step)
{
if (*step < 0) {
Py_ssize_t slicelength = get_slicelength(*start, *stop, *step);
Py_ssize_t slicelength = calc_slicelength(*start, *stop, *step);

*stop = *start + 1;
*start = *stop + *step * (slicelength - 1) - 1;
Expand Down Expand Up @@ -1008,7 +1008,7 @@ bitarray_count(bitarrayobject *self, PyObject *args)
cnt += getbit((bitarrayobject *) self, i);

if (!vi)
cnt = get_slicelength(start, stop, step) - cnt;
cnt = calc_slicelength(start, stop, step) - cnt;
return PyLong_FromSsize_t(cnt);
}
}
Expand Down Expand Up @@ -2032,7 +2032,7 @@ slice_get_indices(PyObject *slice, Py_ssize_t length,
start, stop, step, slicelength) < 0)
return -1;

assert(get_slicelength(*start, *stop, *step) == *slicelength);
assert(calc_slicelength(*start, *stop, *step) == *slicelength);
make_step_positive(start, stop, step);
return 0;
}
Expand Down

0 comments on commit 5c136d6

Please sign in to comment.