From 3c9e5d6b122e55844380bffdcd0bc79afc9c84b8 Mon Sep 17 00:00:00 2001 From: mintsuki Date: Sun, 23 Jun 2024 23:52:47 +0200 Subject: [PATCH] host/limine: Simplify some redundantly written code --- host/limine.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/host/limine.c b/host/limine.c index 833cef43..5bb60c32 100644 --- a/host/limine.c +++ b/host/limine.c @@ -720,41 +720,41 @@ static int bios_install(int argc, char *argv[]) { if (!force_mbr) { mbr = 0; } else { - hint8 = hint8 & 0x80 ? 0x80 : 0x00; + hint8 &= 0x80; device_write(&hint8, 446, sizeof(uint8_t)); } } - any_active = any_active ? any_active : (hint8 & 0x80) != 0; + any_active = any_active || (hint8 & 0x80) != 0; device_read(&hint8, 462, sizeof(uint8_t)); if (hint8 != 0x00 && hint8 != 0x80) { if (!force_mbr) { mbr = 0; } else { - hint8 = hint8 & 0x80 ? 0x80 : 0x00; + hint8 &= 0x80; device_write(&hint8, 462, sizeof(uint8_t)); } } - any_active = any_active ? any_active : (hint8 & 0x80) != 0; + any_active = any_active || (hint8 & 0x80) != 0; device_read(&hint8, 478, sizeof(uint8_t)); if (hint8 != 0x00 && hint8 != 0x80) { if (!force_mbr) { mbr = 0; } else { - hint8 = hint8 & 0x80 ? 0x80 : 0x00; + hint8 &= 0x80; device_write(&hint8, 478, sizeof(uint8_t)); } } - any_active = any_active ? any_active : (hint8 & 0x80) != 0; + any_active = any_active || (hint8 & 0x80) != 0; device_read(&hint8, 494, sizeof(uint8_t)); if (hint8 != 0x00 && hint8 != 0x80) { if (!force_mbr) { mbr = 0; } else { - hint8 = hint8 & 0x80 ? 0x80 : 0x00; + hint8 &= 0x80; device_write(&hint8, 494, sizeof(uint8_t)); } } - any_active = any_active ? any_active : (hint8 & 0x80) != 0; + any_active = any_active || (hint8 & 0x80) != 0; char hintc[64]; device_read(hintc, 4, 8);