]> Git Repo - qemu.git/commitdiff
include/qemu/int128.h: Add function to create Int128 from int64_t
authorPeter Maydell <[email protected]>
Mon, 14 Jun 2021 15:09:43 +0000 (16:09 +0100)
committerPeter Maydell <[email protected]>
Wed, 16 Jun 2021 13:33:52 +0000 (14:33 +0100)
int128_make64() creates an Int128 from an unsigned 64 bit value; add
a function int128_makes64() creating an Int128 from a signed 64 bit
value.

Signed-off-by: Peter Maydell <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-id: 20210614151007[email protected]

include/qemu/int128.h

index 52fc23842119de68a9817d92d8768b448cd8be93..64500385e372ba5c6ab369473e21d67e2e55d47a 100644 (file)
@@ -11,6 +11,11 @@ static inline Int128 int128_make64(uint64_t a)
     return a;
 }
 
+static inline Int128 int128_makes64(int64_t a)
+{
+    return a;
+}
+
 static inline Int128 int128_make128(uint64_t lo, uint64_t hi)
 {
     return (__uint128_t)hi << 64 | lo;
@@ -167,6 +172,11 @@ static inline Int128 int128_make64(uint64_t a)
     return (Int128) { a, 0 };
 }
 
+static inline Int128 int128_makes64(int64_t a)
+{
+    return (Int128) { a, a >> 63 };
+}
+
 static inline Int128 int128_make128(uint64_t lo, uint64_t hi)
 {
     return (Int128) { lo, hi };
This page took 0.024855 seconds and 4 git commands to generate.