diff options
author | Leah Rowe <leah@libreboot.org> | 2023-09-19 16:28:08 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-09-19 16:51:37 +0100 |
commit | 905f3d8e7b52b144806294eb076335520f92af92 (patch) | |
tree | deb8d998d8ec745845e61e9ab2a6e1a5497ed887 /util | |
parent | 231015ef89b194056b9d5eeef3d859b01167990b (diff) |
util/nvmutil: remove xorswap() macro
it's only used once, so just do it once.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/nvmutil/nvmutil.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 79132a12..c133c821 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -65,7 +65,6 @@ void (*cmd)(void) = NULL; if (fstat(f, &st) == -1) err(ERR(), "%s", l) #define handle_endianness(r) if (((uint8_t *) &endian)[0] ^ 1) xorswap_buf(r) -#define xorswap(x, y) x ^= y, y ^= x, x ^= y #define word(pos16, partnum) buf16[pos16 + (partnum << 11)] #define setWord(pos16, p, val16) if ((gbeFileModified = 1) && \ word(pos16, p) != val16) nvmPartModified[p] = 1 | (word(pos16, p) = val16) @@ -264,9 +263,9 @@ validChecksum(int partnum) void xorswap_buf(int partnum) { - uint8_t *nbuf = (uint8_t *) gbe[partnum]; - for (size_t w = 0; w < (nf >> 1); w++) - xorswap(nbuf[w << 1], nbuf[(w << 1) + 1]); + uint8_t *n = (uint8_t *) gbe[partnum]; + for (size_t w = 0, x = 1; w < nf; w += 2, x += 2) + n[w] ^= n[x], n[x] ^= n[w], n[w] ^= n[x]; } void |