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

Richard Henderson <r...@twiddle.net> writes:

Signed-off-by: Richard Henderson <r...@twiddle.net>
---
 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