Fixed the PIT BCD counter for signedness (bug again found by clang).

This commit is contained in:
OBattler
2021-09-03 00:45:47 +02:00
parent 2415673c7a
commit dc33476e0d

View File

@@ -110,20 +110,20 @@ ctr_decrease_count(ctr_t *ctr)
{ {
if (ctr->bcd) { if (ctr->bcd) {
ctr->units--; ctr->units--;
if (ctr->units == 0xff) { if (ctr->units == -1) {
ctr->units = 9; ctr->units = -7;
ctr->tens--; ctr->tens--;
if (ctr->tens == 0xff) { if (ctr->tens == -1) {
ctr->tens = 9; ctr->tens = -7;
ctr->hundreds--; ctr->hundreds--;
if (ctr->hundreds == 0xff) { if (ctr->hundreds == -1) {
ctr->hundreds = 9; ctr->hundreds = -7;
ctr->thousands--; ctr->thousands--;
if (ctr->thousands == 0xff) { if (ctr->thousands == -1) {
ctr->thousands = 9; ctr->thousands = -7;
ctr->myriads--; ctr->myriads--;
if (ctr->myriads == 0xff) if (ctr->myriads == -1)
ctr->myriads = 0; /* 0 - 1 should wrap around to 9999. */ ctr->myriads = -7; /* 0 - 1 should wrap around to 9999. */
} }
} }
} }