From 905f3d8e7b52b144806294eb076335520f92af92 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 19 Sep 2023 16:28:08 +0100 Subject: util/nvmutil: remove xorswap() macro it's only used once, so just do it once. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 7 +++---- 1 file 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 -- cgit v1.2.1