Hi, I think there is a small bug in the AoS initialization code in the AoS vs SoA article.
Current code:
for (int i = 0; i < M; i++)
q[k][0] = p[i];
for (int j = 1; j < D; j++)
q[i][0] ^= (q[j][i] = rand());
k = q[k][0];
}
I believe the intended logic is to initialize row q[k], so the inner loop should write to q[k][j], not q[j][i].
Also, after xoring random fields into q[k][0], q[k][0] no longer directly stores the next pointer. So k = q[k][0] is not correct here. The next pointer should still be p[i].
Suggested fix:
for (int i = 0; i < M; i++) {
q[k][0] = p[i];
for (int j = 1; j < D; j++) {
q[k][0] ^= (q[k][j] = rand());
}
k = p[i];
}
Thanks for the great article!
Hi, I think there is a small bug in the AoS initialization code in the AoS vs SoA article.
Current code:
I believe the intended logic is to initialize row
q[k], so the inner loop should write toq[k][j], notq[j][i].Also, after xoring random fields into
q[k][0],q[k][0]no longer directly stores the next pointer. Sok = q[k][0]is not correct here. The next pointer should still bep[i].Suggested fix:
Thanks for the great article!