Skip to content

Commit

Permalink
Remove superfluous condition, add a couple of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lkirk committed Jan 8, 2024
1 parent 4972a22 commit e083ca2
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions c/tskit/trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -2391,6 +2391,7 @@ get_stat_matrix_site_indices(tsk_size_t n_sites, tsk_size_t n_rows,
goto out;

Check warning on line 2391 in c/tskit/trees.c

View check run for this annotation

Codecov / codecov/patch

c/tskit/trees.c#L2390-L2391

Added lines #L2390 - L2391 were not covered by tests
}

// Iterate rows and columns until we've exhaused one of the lists
while ((r < n_rows) && (c < n_cols)) {
if (row_sites[r] < col_sites[c]) {
rdiff_idx[n_rdiff] = s;
Expand All @@ -2417,24 +2418,23 @@ get_stat_matrix_site_indices(tsk_size_t n_sites, tsk_size_t n_rows,
c++;
}
}
if (r < n_rows) {
while (r < n_rows) {
rdiff[n_rdiff] = r;
rdiff_idx[n_rdiff] = s;
sites[s] = row_sites[r];
n_rdiff++;
s++;
r++;
}
} else if (c < n_cols) {
while (c < n_cols) {
cdiff[n_cdiff] = c;
cdiff_idx[n_cdiff] = s;
sites[s] = col_sites[c];
n_cdiff++;
s++;
c++;
}

// If there are any items remaining in the other list, drain it
while (r < n_rows) {
rdiff[n_rdiff] = r;
rdiff_idx[n_rdiff] = s;
sites[s] = row_sites[r];
n_rdiff++;
s++;
r++;
}
while (c < n_cols) {
cdiff[n_cdiff] = c;
cdiff_idx[n_cdiff] = s;
sites[s] = col_sites[c];
n_cdiff++;
s++;
c++;
}

idx->n_sites = s;
Expand Down

0 comments on commit e083ca2

Please sign in to comment.