summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-02 23:29:00 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-02 23:29:00 +0000
commit6dd91134bd08092d8cc03d9e2ae8cc23efb9b86e (patch)
treec8302086249b71425cdd58bc61ee975d2b7c3a98 /util
parent53e386d2b59f85c345eda2facd3084f996c7cf26 (diff)
util/nvmutil: don't use xor swap
it doesn't save any time on modern systems, and it's just confusing for some people to read. i mean, i understand it instinctively, but normal people do it with a swap variable. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index bbbb4e3f..7c0d0c31 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -464,9 +464,9 @@ 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] ^= n[w];
- n[w] ^= n[x];
+ n[x] ^= chg;
}
}