From 95b294db05cd92a3a915484532a4dda230c8ae56 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 6 Mar 2026 13:47:16 +0000 Subject: util/nvmutil: inline pos calculation on word() we don't need a whole function. i previously did it for clarity, but simply setting a variable all in one line is totally fine. Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 9b0ac3f0..300217e8 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -43,7 +43,6 @@ static void cmd_swap(void); static int good_checksum(int); static uint16_t word(size_t, int); static void set_word(size_t, int, uint16_t); -static size_t get_word_pos(size_t, int); static void check_bound(size_t, int); static void write_gbe(void); static void write_gbe_part(int); @@ -620,7 +619,7 @@ word(size_t pos16, int p) size_t pos; check_bound(pos16, p); - pos = get_word_pos(pos16, p); + pos = (pos16 << 1) + ((size_t)p * SIZE_4KB); return (uint16_t)buf[pos] | ((uint16_t)buf[pos + 1] << 8); } @@ -631,7 +630,7 @@ set_word(size_t pos16, int p, uint16_t val16) size_t pos; check_bound(pos16, p); - pos = get_word_pos(pos16, p); + pos = (pos16 << 1) + ((size_t)p * SIZE_4KB); buf[pos] = (uint8_t)(val16 & 0xff); buf[pos + 1] = (uint8_t)(val16 >> 8); @@ -639,15 +638,6 @@ set_word(size_t pos16, int p, uint16_t val16) part_modified[p] = 1; } -static size_t -get_word_pos(size_t pos16, int p) -{ - size_t off = SIZE_4KB * p; - size_t pos = (pos16 << 1) + off; - - return pos; -} - static void check_bound(size_t c, int p) { -- cgit v1.2.1