guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bug in sort.c


From: Marius Vollmer
Subject: Re: bug in sort.c
Date: Tue, 19 Oct 2004 16:33:20 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

Roland Orre <address@hidden> writes:

> The following two lines in scm_restricted_vector_sort_x
> are wrong:
>
>   SCM_VALIDATE_INUM_RANGE (4, endpos,0, vlen+1);
>   len = SCM_INUM (endpos) - spos;
>
> they should be:
>
>   SCM_VALIDATE_INUM_RANGE (4, endpos,0, vlen);
>   len = SCM_INUM (endpos) - spos + 1;

I think the code is correct: we need to have

    0 <= startpos <= endpos <= vlen

The element with index endpos is not included in the sort, thus we
will sort

    len = endpos - spos

elements.

The docstring needs to be clearer about this, tho.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]