diff options
author | Leah Rowe <leah@libreboot.org> | 2025-01-27 04:09:09 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-01-27 04:09:09 +0000 |
commit | 063fef14d3457fb5324848183fb49d5d47391e54 (patch) | |
tree | da59ea25b8fa052c4811bf6ff7b0b28311583ecf | |
parent | fd1bbdc96cb218bc3d550202aba363e47b4dcbce (diff) |
util/nvmutil: make swap() a bit clearer
don't sizecode. show the individual steps clearly.
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r-- | util/nvmutil/nvmutil.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index c2b563e0..f8eb3844 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -441,6 +441,10 @@ swap(int partnum) /* swaps bytes in words, not pointers. */ size_t w, x; uint8_t *n = (uint8_t *) gbe[partnum]; - for (w = nf * ((uint8_t *) &e)[0], x = 1; w < NVM_SIZE; w += 2, x += 2) - n[w] ^= n[x], n[x] ^= n[w], n[w] ^= n[x]; + for (w = nf * ((uint8_t *) &e)[0], x = 1; w < NVM_SIZE; + w += 2, x += 2) { + n[w] ^= n[x]; + n[x] ^= n[w]; + n[w] ^= n[x]; + } } |