nvmutil: fix the swap function

irrelevant for most users, who are on little endian
anyway, but i broke the swap function on big endian
systems. this fixes it.

the new function uses an intermediate variable instead
of xor swapping, but i accidentally left some relics of
of the old xor swaps in place. this fixes that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-03 03:50:22 +00:00
parent c721d6f4f4
commit efe2635c12
+2 -2
View File
@@ -452,8 +452,8 @@ swap(int partnum)
for (size_t w = NVM_SIZE * ((uint8_t *) &e)[0], x = 1;
w < NVM_SIZE; w += 2, x += 2) {
uint8_t chg = n[w];
n[w] ^= n[x];
n[x] ^= chg;
n[w] = n[x];
n[x] = chg;
}
}