[PATCH v4 5/6] stdlib: Remove use of mergesort on qsort (BZ 21719)
Paul Eggert
eggert@cs.ucla.edu
Wed Jul 12 22:04:50 GMT 2023
On 2023-07-11 12:07, Adhemerval Zanella via Libc-alpha wrote:
> @@ -152,6 +151,7 @@ pop (stack_node *top, char **lo, char **hi, size_t *depth)
> static inline size_t
> parent (size_t i, unsigned int lsbit, size_t size)
> {
> + /* The below is logically equivalent to 'if (i & lsbit) i -= size'. */
> i -= size;
> i -= size & -(i & lsbit);
> return i / 2;
Doesn't the comment belong to the patch that introduced this code, not
to patch 5?
Also, it's not clear which of the three lines the phrase "The below"
refers to. I assume it refers to the line "i -= size & -(i & lsbit);".
If so, this should be made clearer, e.g.:
i -= size;
i -= size & -(i & lsbit); /* i.e., 'if (i & lsbit) i -= size;' */
return i / 2;
More information about the Libc-alpha
mailing list