[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/19] host-utils: move abs64() to host-utils
From: |
Luis Pires |
Subject: |
[PATCH 02/19] host-utils: move abs64() to host-utils |
Date: |
Tue, 24 Aug 2021 11:27:13 -0300 |
Move abs64 to host-utils so it can be reused elsewhere.
Also made it inline.
Signed-off-by: Luis Pires <luis.pires@eldorado.org.br>
---
hw/i386/kvm/i8254.c | 5 -----
include/qemu/host-utils.h | 8 ++++++++
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index fa68669e8a..761034743b 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -59,11 +59,6 @@ struct KVMPITClass {
DeviceRealize parent_realize;
};
-static int64_t abs64(int64_t v)
-{
- return v < 0 ? -v : v;
-}
-
static void kvm_pit_update_clock_offset(KVMPITState *s)
{
int64_t offset, clock_offset;
diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h
index 711b221704..5fec44a9c4 100644
--- a/include/qemu/host-utils.h
+++ b/include/qemu/host-utils.h
@@ -357,6 +357,14 @@ static inline uint64_t revbit64(uint64_t x)
#endif
}
+/**
+ * Return the absolute value of a 64-bit integer
+ */
+static inline int64_t abs64(int64_t v)
+{
+ return v < 0 ? -v : v;
+}
+
/**
* sadd32_overflow - addition with overflow indication
* @x, @y: addends
--
2.25.1
- [PATCH 00/19] target/ppc: DFP instructions using decodetree, Luis Pires, 2021/08/24
- [PATCH 01/19] host-utils: Fix overflow detection in divu128(), Luis Pires, 2021/08/24
- [PATCH 02/19] host-utils: move abs64() to host-utils,
Luis Pires <=
- Re: [PATCH 02/19] host-utils: move abs64() to host-utils, David Gibson, 2021/08/25
- RE: [PATCH 02/19] host-utils: move abs64() to host-utils, Luis Fernando Fujita Pires, 2021/08/25
- Re: [PATCH 02/19] host-utils: move abs64() to host-utils, Eduardo Habkost, 2021/08/25
- RE: [PATCH 02/19] host-utils: move abs64() to host-utils, Luis Fernando Fujita Pires, 2021/08/25
- Re: [PATCH 02/19] host-utils: move abs64() to host-utils, Eduardo Habkost, 2021/08/25
- Re: [PATCH 02/19] host-utils: move abs64() to host-utils, Philippe Mathieu-Daudé, 2021/08/25
- RE: [PATCH 02/19] host-utils: move abs64() to host-utils, Luis Fernando Fujita Pires, 2021/08/27
[PATCH 03/19] host-utils: move checks out of divu128/divs128, Luis Pires, 2021/08/24
[PATCH 04/19] host-utils: add 128-bit quotient support to divu128/divs128, Luis Pires, 2021/08/24
[PATCH 05/19] host-utils: add unit tests for divu128/divs128, Luis Pires, 2021/08/24