[PATCH] "Towers of Hanoi" Mergesort Implementation
Roger Sayle
roger@eyesopen.com
Thu Jan 17 22:43:00 GMT 2002
> > 2002-01-16 Roger Sayle <roger@eyesopen.com>
> > * stdlib/msort.c (msort_with_tmp): Replace implementation with
> > more efficient "Towers of Hanoi" mergesort.
> > (hanoi_sort, hanoi_sort_int, hanoi_sort_long): New functions,
> > for generic, sizeof(int) and sizeof(long) variants respectively.
>
> This patch looks good. I've applied it now with only a few
> modifications. Besides formatting the main change was to avoid adding
> hanoi_sort_long if long has the same size as int. The compiler might
> be clever enough to eliminate the if branch but the function
> definition would remain. With a few #ifs the problem is solved.
Many Thanks.
Roger
--
More information about the Libc-alpha
mailing list