host/limine: Simplify some redundantly written code

This commit is contained in:
mintsuki 2024-06-23 23:52:47 +02:00
parent 5ab25407c6
commit 3c9e5d6b12

View File

@ -720,41 +720,41 @@ static int bios_install(int argc, char *argv[]) {
if (!force_mbr) { if (!force_mbr) {
mbr = 0; mbr = 0;
} else { } else {
hint8 = hint8 & 0x80 ? 0x80 : 0x00; hint8 &= 0x80;
device_write(&hint8, 446, sizeof(uint8_t)); 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)); device_read(&hint8, 462, sizeof(uint8_t));
if (hint8 != 0x00 && hint8 != 0x80) { if (hint8 != 0x00 && hint8 != 0x80) {
if (!force_mbr) { if (!force_mbr) {
mbr = 0; mbr = 0;
} else { } else {
hint8 = hint8 & 0x80 ? 0x80 : 0x00; hint8 &= 0x80;
device_write(&hint8, 462, sizeof(uint8_t)); 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)); device_read(&hint8, 478, sizeof(uint8_t));
if (hint8 != 0x00 && hint8 != 0x80) { if (hint8 != 0x00 && hint8 != 0x80) {
if (!force_mbr) { if (!force_mbr) {
mbr = 0; mbr = 0;
} else { } else {
hint8 = hint8 & 0x80 ? 0x80 : 0x00; hint8 &= 0x80;
device_write(&hint8, 478, sizeof(uint8_t)); 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)); device_read(&hint8, 494, sizeof(uint8_t));
if (hint8 != 0x00 && hint8 != 0x80) { if (hint8 != 0x00 && hint8 != 0x80) {
if (!force_mbr) { if (!force_mbr) {
mbr = 0; mbr = 0;
} else { } else {
hint8 = hint8 & 0x80 ? 0x80 : 0x00; hint8 &= 0x80;
device_write(&hint8, 494, sizeof(uint8_t)); 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]; char hintc[64];
device_read(hintc, 4, 8); device_read(hintc, 4, 8);