qemu-ppc
[Top][All Lists]
Advanced

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

[PATCH for-6.2 1/2] include/qemu/int128.h: introduce bswap128s


From: matheus . ferst
Subject: [PATCH for-6.2 1/2] include/qemu/int128.h: introduce bswap128s
Date: Mon, 16 Aug 2021 16:13:15 -0300

From: Matheus Ferst <matheus.ferst@eldorado.org.br>

Introduces bswap128s based on bswap128. Since bswap128 is defined using
int128_* methods available in either CONFIG_INT128 or !CONFIG_INT128
builds, place both outside of #ifdef CONFIG_INT128.

Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
 include/qemu/int128.h | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/include/qemu/int128.h b/include/qemu/int128.h
index 64500385e3..e0d385628c 100644
--- a/include/qemu/int128.h
+++ b/include/qemu/int128.h
@@ -153,11 +153,6 @@ static inline void int128_subfrom(Int128 *a, Int128 b)
     *a -= b;
 }
 
-static inline Int128 bswap128(Int128 a)
-{
-    return int128_make128(bswap64(int128_gethi(a)), bswap64(int128_getlo(a)));
-}
-
 #else /* !CONFIG_INT128 */
 
 typedef struct Int128 Int128;
@@ -338,4 +333,15 @@ static inline void int128_subfrom(Int128 *a, Int128 b)
 }
 
 #endif /* CONFIG_INT128 */
+
+static inline Int128 bswap128(Int128 a)
+{
+    return int128_make128(bswap64(int128_gethi(a)), bswap64(int128_getlo(a)));
+}
+
+static inline void bswap128s(Int128 *s)
+{
+    *s = bswap128(*s);
+}
+
 #endif /* INT128_H */
-- 
2.25.1




reply via email to

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