util/nvmutil: tidy up set_mac_nib

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-06 16:55:23 +00:00
parent 9e32456c8c
commit 199dbad96d
+6 -6
View File
@@ -408,13 +408,13 @@ set_mac_nib(int mac_pos, int nib)
mac[mac_pos + nib]); mac[mac_pos + nib]);
/* If random, ensure that local/unicast bits are set */ /* If random, ensure that local/unicast bits are set */
if (byte == 0 && nib == 1) { if (byte == 0 && nib == 1 &&
if ((mac[mac_pos + nib] == '?') || (mac[mac_pos + nib] == '?') ||
(mac[mac_pos + nib] == 'x') || (mac[mac_pos + nib] == 'x') ||
(mac[mac_pos + nib] == 'X')) /* random */ (mac[mac_pos + nib] == 'X')) /* random */
h = (h & 0xE) | 2; /* local, unicast */ h = (h & 0xE) | 2; /* local, unicast */
}
/* Store the new nibble as part of the new MAC address */
macbuf[byte >> 1] |= (uint16_t)h << macbuf[byte >> 1] |= (uint16_t)h <<
(((byte & 1) << 3) + (4 * (nib ^ 1))); (((byte & 1) << 3) + (4 * (nib ^ 1)));
} }