util/nvmutil: make setWord a macro

253 sloccount on nvmutil.c now, versus 258

Signed-off-by: Leah Rowe <leah@libreboot.org>
btrfsvols
Leah Rowe 2023-09-19 16:18:13 +01:00
parent d9bed11501
commit 231015ef89
1 changed files with 5 additions and 11 deletions

View File

@ -26,7 +26,6 @@ void cmd_setchecksum(void);
void cmd_brick(void);
void cmd_copy(void);
int validChecksum(int partnum);
void setWord(int pos16, int partnum, uint16_t val16);
void xorswap_buf(int partnum);
void writeGbeFile(void);
@ -68,6 +67,8 @@ void (*cmd)(void) = NULL;
#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)
int
main(int argc, char *argv[])
@ -238,7 +239,7 @@ void
cmd_brick(void)
{
if (validChecksum(part))
setWord(0x3F, part, (word(0x3F, part)) ^ 0xFF);
setWord(0x3F, part, ((word(0x3F, part)) ^ 0xFF));
}
void
@ -260,13 +261,6 @@ validChecksum(int partnum)
return (errno = ECANCELED) & 0;
}
void
setWord(int pos16, int partnum, uint16_t val16)
{
if ((gbeFileModified = 1) && word(pos16, partnum) != val16)
nvmPartModified[partnum] = 1 | (word(pos16, partnum) = val16);
}
void
xorswap_buf(int partnum)
{