protected static final int getStop1(final PyObject s_stop, final int start, final int step, final int length) {
        int stop;
        if (step < 0) {
            stop = PyMultiarray.getIndex(s_stop, -1);
            if (stop < -1) {
                stop = length + stop;
            }
            if (stop < -1) {
                stop = -1;
            }
            if (stop > length - 1) {
                stop = length - 1;
            }
        } else {
            stop = PyMultiarray.getIndex(s_stop, length);
            if (stop < 0) {
                stop = length + stop;
            }
            if (stop < 0) {
                stop = 0;
            }
            if (stop > length) {
                stop = length;
            }
        }
        if ((stop - start) * step < 0) {
            stop = start;
        }
        return stop;
    }