summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorlbmkplaceholder <placeholder@lbmkplaceholder.com>2022-12-23 10:37:30 +0000
committerlbmkplaceholder <placeholder@lbmkplaceholder.com>2022-12-23 10:42:19 +0000
commit448ee5105de59e1eb4324ed62070bc130bd32c7a (patch)
tree0d3bc8600ddbe8e8f251a9cd3bfe01a3d455ed90 /util
parenteffcb942ceef282536d1da7de584357bdda5f9f3 (diff)
util/nvmutil: optimise cmd_swap() further
don't do xor swap. we know gbe2 is always 4KB higher than gbe in memory, so we can just set gbe2 to the value of gbe, and OR the size in bytes of 4KB into gbe2 this is only a marginal speed boost, negligible even, but it's done for the lulz
Diffstat (limited to 'util')
-rw-r--r--util/nvmutil/nvmutil.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index 9a70634..7627355 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -355,18 +355,16 @@ void
cmd_swap(void)
{
int part0, part1;
- size_t g1 = (size_t) gbe;
- size_t g2 = (size_t) gbe2;
+ size_t ptr;
part0 = validChecksum(0);
part1 = validChecksum(1);
if (part0 || part1) {
- g1 ^= g2;
- g2 ^= g1;
- g1 ^= g2;
- gbe = (uint8_t *) g1;
- gbe2 = (uint8_t *) g2;
+ gbe2 = gbe;
+ ptr = (size_t) gbe;
+ ptr |= SIZE_4KB;
+ gbe = (uint8_t *) ptr;
gbeFileModified = 1;
nvmPartModified[0] = 1;