for (k = j = 0; k < 4; ++k) {
for (l = k; l < 4; ++l) {
int t, x = map[k], y = map[l];
- if (x > y) t = x, x = y, y = t;
- g[j++] = p[x * b->n_alleles - x * (x-1) / 2 + (y - x)];
+ if (x > y) t = x, x = y, y = t; // swap
+ g[j++] = p[y * (y+1) / 2 + x];
}
}
printf("%s\t%d\t%c", h->ns[b->tid], b->pos+1, *b->ref);