:: commit 3c9e5d6b122e55844380bffdcd0bc79afc9c84b8

mintsuki <mintsuki@protonmail.com> — 2024-06-23 21:52

parents: 5ab25407c6

host/limine: Simplify some redundantly written code

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);
tab: 248 wrap: offon