Skip to content

Commit adf6819

Browse files
ubizjakIngo Molnar
authored andcommitted
x86/bootflag: Micro-optimize sbf_write()
Change parity bit with XOR when !parity instead of masking bit out and conditionally setting it when !parity. Saves a couple of bytes in the object file. Co-developed-by: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20250226153709.6370-1-ubizjak@gmail.com
1 parent 7d8f03f commit adf6819

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

arch/x86/kernel/bootflag.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ static void __init sbf_write(u8 v)
3838
unsigned long flags;
3939

4040
if (sbf_port != -1) {
41-
v &= ~SBF_PARITY;
4241
if (!parity(v))
43-
v |= SBF_PARITY;
42+
v ^= SBF_PARITY;
4443

4544
printk(KERN_INFO "Simple Boot Flag at 0x%x set to 0x%x\n",
4645
sbf_port, v);

0 commit comments

Comments
 (0)