qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 04/34] int128: Use __int128 if available


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH v3 04/34] int128: Use __int128 if available
Date: Fri, 9 Sep 2016 10:38:37 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 09/09/2016 10:19 AM, Alex Bennée wrote:

Richard Henderson <address@hidden> writes:

Signed-off-by: Richard Henderson <address@hidden>
---
 include/qemu/int128.h | 135 +++++++++++++++++++++++++++++++++++++++++++++++++-
 tests/test-int128.c   |  22 ++++----
 2 files changed, 145 insertions(+), 12 deletions(-)

diff --git a/include/qemu/int128.h b/include/qemu/int128.h
index 52aaf99..08f1db1 100644
--- a/include/qemu/int128.h
+++ b/include/qemu/int128.h
@@ -1,6 +1,138 @@
 #ifndef INT128_H
 #define INT128_H

+#ifdef CONFIG_INT128
+
+typedef __int128 Int128;
+
+static inline Int128 int128_make64(uint64_t a)
+{
+    return a;
+}
+
+static inline uint64_t int128_get64(Int128 a)
+{
+    uint64_t r = a;
+    assert(r == a);
+    return r;
+}

So is _get64 just an alias for getlo? It looks fragile for the time
someone has a > 64 bit number stuffed in before they fetch it.

You'll note that this interface is not my invention.  However...

It's asserting that we *don't* have a > 64 bit number stuffed in. Prior to me adding make_int128, the only way to get a > 64 bit number was via arithmetic.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]