From dfb6fdd2f907d4d2f6d894758517194d13588078 Mon Sep 17 00:00:00 2001 From: rheno Date: Fri, 15 Oct 2021 16:00:35 +0000 Subject: [PATCH] error: implicit conversion loses precision when running make (Apple clang version 13.0.0) Signed-off-by: rheno --- src/lib/pci_ahci.c | 4 ++-- src/lib/vmm/io/vatpit.c | 2 +- src/lib/vmm/vmm_instruction_emul.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/pci_ahci.c b/src/lib/pci_ahci.c index 4fc96ebe..c25f08d7 100644 --- a/src/lib/pci_ahci.c +++ b/src/lib/pci_ahci.c @@ -214,8 +214,8 @@ static inline void lba_to_msf(uint8_t *buf, int lba) { lba += 150; buf[0] = (uint8_t) ((lba / 75) / 60); - buf[1] = (lba / 75) % 60; - buf[2] = lba % 75; + buf[1] = (uint8_t) ((lba / 75) % 60); + buf[2] = (uint8_t) (lba % 75); } /* diff --git a/src/lib/vmm/io/vatpit.c b/src/lib/vmm/io/vatpit.c index 1ecca357..ea84e07a 100644 --- a/src/lib/vmm/io/vatpit.c +++ b/src/lib/vmm/io/vatpit.c @@ -200,7 +200,7 @@ pit_update_counter(struct vatpit *vatpit, struct channel *c, bool latch) delta_ticks = (sbinuptime() - c->now_sbt) / vatpit->freq_sbt; - lval = c->initial - delta_ticks % c->initial; + lval = (uint16_t) (c->initial - delta_ticks % c->initial); if (latch) { c->olbyte = 2; diff --git a/src/lib/vmm/vmm_instruction_emul.c b/src/lib/vmm/vmm_instruction_emul.c index 3f277c68..f80d79bb 100644 --- a/src/lib/vmm/vmm_instruction_emul.c +++ b/src/lib/vmm/vmm_instruction_emul.c @@ -1376,7 +1376,7 @@ emulate_bittest(void *vm, int vcpuid, uint64_t gpa, struct vie *vie, * "Range of Bit Positions Specified by Bit Offset Operands" */ bitmask = vie->opsize * 8 - 1; - bitoff = vie->immediate & bitmask; + bitoff = (int) (vie->immediate & bitmask); /* Copy the bit into the Carry flag in %rflags */ if (val & (1UL << bitoff))