-
Notifications
You must be signed in to change notification settings - Fork 88
Open
Description
In sort_extra.h (see below), the type of counter variables (m,h etc.) should be size_t since the upper bound (L variable) is size_t. Aside from causing a compilation warning (and an error in build if so setup), it would probably be a bug with very large sorting sets when int type may not not be sufficient.
The only change is "int" to "size_t" below (in bold):
--- a/libsort/sort_extra.h
+++ b/libsort/sort_extra.h
@@ -1183,7 +1183,7 @@ static void GRAIL_REC_MERGE(SORT_TYPE *A, int L1, int L2) {
}
SORT_DEF void REC_STABLE_SORT(SORT_TYPE *arr, size_t L) {
- int m, h, p0, p1, rest;
-
size_t m, h, p0, p1, rest;
for (m = 1; m < L; m += 2) {
if (SORT_CMP_A(arr + m - 1, arr + m) > 0) {
@@ -1191,7 +1191,7 @@ SORT_DEF void REC_STABLE_SORT(SORT_TYPE *arr, size_t L) {
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels