Skip to content

Commit d3fe9a8

Browse files
committed
gradual reintroduction of older changes
1 parent 6a65009 commit d3fe9a8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/fsort.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ static void dradix_r( // single-threaded recursive worker
4343
return;
4444
}
4545

46-
uint64_t cumSum=0;
47-
for (uint64_t i=0; cumSum<n; ++i) { // cumSum<n better than i<width as may return early
46+
for (uint64_t i=0, cumSum = 0; cumSum<n; ++i) { // cumSum<n better than i<width as may return early
4847
uint64_t tmp;
4948
if ((tmp=counts[i])) { // don't cumulate through 0s, important below to save a wasteful memset to zero
5049
counts[i] = cumSum;
@@ -53,7 +52,7 @@ static void dradix_r( // single-threaded recursive worker
5352
} // leaves cumSum==n && 0<i && i<=width
5453

5554
tmp=in;
56-
for (uint64_t i=0; i<n; ++i) { // go forwards not backwards to give cpu pipeline better chance
55+
for (uint64_t i = 0; i<n; ++i) { // go forwards not backwards to give cpu pipeline better chance
5756
int thisx = (*(uint64_t *)tmp - minULL) >> fromBit & mask;
5857
working[ counts[thisx]++ ] = *tmp;
5958
tmp++;
@@ -71,8 +70,7 @@ static void dradix_r( // single-threaded recursive worker
7170
return;
7271
}
7372

74-
cumSum=0;
75-
for (int i=0; cumSum<n; ++i) { // again, cumSum<n better than i<width as it can return early
73+
for (uint64_t i = 0, cumSum = 0; cumSum<n; ++i) { // again, cumSum<n better than i<width as it can return early
7674
if (counts[i] == 0) continue;
7775
uint64_t thisN = counts[i] - cumSum; // undo cummulate; i.e. diff
7876
if (thisN <= INSERT_THRESH) {

0 commit comments

Comments
 (0)