summaryrefslogtreecommitdiff
path: root/src/arch/vmpa.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2016-01-04 01:32:44 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2016-01-04 01:33:13 (GMT)
commit239694d99ad81f1e435125e76a2a930213d06b21 (patch)
treec02344549f10d618159198bd90f1e010d9def258 /src/arch/vmpa.c
parent7b3364f3af43961df7c5c7bcd0fe7407e944f16f (diff)
Treated phys_t as uint64_t to avoid huge differences get considered as negative numbers.
Diffstat (limited to 'src/arch/vmpa.c')
-rw-r--r--src/arch/vmpa.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/arch/vmpa.c b/src/arch/vmpa.c
index e2da876..25b01c3 100644
--- a/src/arch/vmpa.c
+++ b/src/arch/vmpa.c
@@ -299,10 +299,10 @@ phys_t compute_vmpa_diff(const vmpa2t *a, const vmpa2t *b)
result = VMPA_NO_PHYSICAL;
if (a->physical != VMPA_NO_PHYSICAL && b->physical != VMPA_NO_PHYSICAL)
- result = (b->physical > a->physical ? b->physical - a->physical : a->physical- b->physical);
+ result = (b->physical > a->physical ? b->physical - a->physical : a->physical - b->physical);
else if (a->virtual != VMPA_NO_VIRTUAL && b->virtual != VMPA_NO_VIRTUAL)
- result = (phys_t)(b->virtual > a->virtual ? b->virtual - a->virtual : a->virtual- b->virtual);
+ result = (phys_t)(b->virtual > a->virtual ? b->virtual - a->virtual : a->virtual - b->virtual);
return result;
@@ -398,23 +398,23 @@ static char *_phys_t_to_string(phys_t phys, MemoryDataSize msize, char buffer[VM
switch (msize)
{
case MDS_8_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN,"0x%02" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN,"0x%02" PRIx64, phys);
break;
case MDS_16_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%04" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%04" PRIx64, phys);
break;
case MDS_32_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%08" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%08" PRIx64, phys);
break;
case MDS_64_BITS:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%016" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%016" PRIx64, phys);
break;
default:
- ret = snprintf(buffer, VMPA_MAX_LEN, "0x%" PRIx64, (uint64_t)phys);
+ ret = snprintf(buffer, VMPA_MAX_LEN, "0x%" PRIx64, phys);
break;
}