qemu-devel
[Top][All Lists]
Advanced

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

[RFC PATCH 10/25] qemu/bswap: Use LD_CONVERT macro to emit 16-bit signed


From: Philippe Mathieu-Daudé
Subject: [RFC PATCH 10/25] qemu/bswap: Use LD_CONVERT macro to emit 16-bit signed load/store code
Date: Tue, 18 May 2021 20:36:40 +0200

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/qemu/bswap.h | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
index c2fd4f31d20..af9b18f373d 100644
--- a/include/qemu/bswap.h
+++ b/include/qemu/bswap.h
@@ -343,13 +343,6 @@ static inline int lduw_he_p(const void *ptr)
     return r;
 }
 
-static inline int ldsw_he_p(const void *ptr)
-{
-    int16_t r;
-    __builtin_memcpy(&r, ptr, sizeof(r));
-    return r;
-}
-
 static inline int ldl_he_p(const void *ptr)
 {
     int32_t r;
@@ -379,11 +372,6 @@ static inline int lduw_le_p(const void *ptr)
     return (uint16_t)le_bswap(lduw_he_p(ptr), 16);
 }
 
-static inline int ldsw_le_p(const void *ptr)
-{
-    return (int16_t)le_bswap(lduw_he_p(ptr), 16);
-}
-
 static inline int ldl_le_p(const void *ptr)
 {
     return le_bswap(ldl_he_p(ptr), 32);
@@ -409,11 +397,6 @@ static inline int lduw_be_p(const void *ptr)
     return (uint16_t)be_bswap(lduw_he_p(ptr), 16);
 }
 
-static inline int ldsw_be_p(const void *ptr)
-{
-    return (int16_t)be_bswap(lduw_he_p(ptr), 16);
-}
-
 static inline int ldl_be_p(const void *ptr)
 {
     return be_bswap(ldl_he_p(ptr), 32);
@@ -471,6 +454,7 @@ static inline void st ## size ## _ ## endian ## _p(void 
*ptr, vtype v)\
     ST_CONVERT_END(be, bits, vtype, size)
 
 ST_CONVERT(16, uint16_t, w)
+LD_CONVERT(16, int, int16_t, sw)
 
 static inline unsigned long leul_to_cpu(unsigned long v)
 {
-- 
2.26.3




reply via email to

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