--- mingw-w64-crt/misc/winbs_uint64.c | 35 +------------------------------ mingw-w64-crt/misc/winbs_ulong.c | 16 +------------- mingw-w64-crt/misc/winbs_ushort.c | 13 +----------- 3 files changed, 3 insertions(+), 61 deletions(-)
diff --git a/mingw-w64-crt/misc/winbs_uint64.c b/mingw-w64-crt/misc/winbs_uint64.c index c0b316221..0158eb6f7 100644 --- a/mingw-w64-crt/misc/winbs_uint64.c +++ b/mingw-w64-crt/misc/winbs_uint64.c @@ -2,38 +2,5 @@ unsigned long long __cdecl _byteswap_uint64(unsigned long long _Int64); unsigned long long __cdecl _byteswap_uint64(unsigned long long _Int64) { -#if defined(_AMD64_) || defined(__x86_64__) - unsigned long long retval; - __asm__ __volatile__ ("bswapq %[retval]" : [retval] "=rm" (retval) : "[retval]" (_Int64)); - return retval; -#elif defined(_X86_) || defined(__i386__) - union { - long long int64part; - struct { - unsigned long lowpart; - unsigned long hipart; - }; - } retval; - retval.int64part = _Int64; - __asm__ __volatile__ ("bswapl %[lowpart]\n" - "bswapl %[hipart]\n" - : [lowpart] "=rm" (retval.hipart), [hipart] "=rm" (retval.lowpart) : "[lowpart]" (retval.lowpart), "[hipart]" (retval.hipart)); - return retval.int64part; -#else - unsigned char *b = (void*)&_Int64; - unsigned char tmp; - tmp = b[0]; - b[0] = b[7]; - b[7] = tmp; - tmp = b[1]; - b[1] = b[6]; - b[6] = tmp; - tmp = b[2]; - b[2] = b[5]; - b[5] = tmp; - tmp = b[3]; - b[3] = b[4]; - b[4] = tmp; - return _Int64; -#endif + return __builtin_bswap64(_Int64); } diff --git a/mingw-w64-crt/misc/winbs_ulong.c b/mingw-w64-crt/misc/winbs_ulong.c index 9cd6b2907..e23c113a5 100644 --- a/mingw-w64-crt/misc/winbs_ulong.c +++ b/mingw-w64-crt/misc/winbs_ulong.c @@ -2,19 +2,5 @@ unsigned long __cdecl _byteswap_ulong (unsigned long _Long); unsigned long __cdecl _byteswap_ulong (unsigned long _Long) { -#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) - unsigned long retval; - __asm__ __volatile__ ("bswapl %[retval]" : [retval] "=rm" (retval) : "[retval]" (_Long)); - return retval; -#else - unsigned char *b = (void*)&_Long; - unsigned char tmp; - tmp = b[0]; - b[0] = b[3]; - b[3] = tmp; - tmp = b[1]; - b[1] = b[2]; - b[2] = tmp; - return _Long; -#endif /* defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) */ + return __builtin_bswap32(_Long); } diff --git a/mingw-w64-crt/misc/winbs_ushort.c b/mingw-w64-crt/misc/winbs_ushort.c index 46b57fda4..b1b9ef329 100644 --- a/mingw-w64-crt/misc/winbs_ushort.c +++ b/mingw-w64-crt/misc/winbs_ushort.c @@ -2,16 +2,5 @@ unsigned short __cdecl _byteswap_ushort(unsigned short _Short); unsigned short __cdecl _byteswap_ushort(unsigned short _Short) { -#if defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) - unsigned short retval; - __asm__ __volatile__ ("rorw $8, %w[retval]" : [retval] "=rm" (retval) : "[retval]" (_Short)); - return retval; -#else - unsigned char *b = (void*)&_Short; - unsigned char tmp; - tmp = b[0]; - b[0] = b[1]; - b[1] = tmp; - return _Short; -#endif /* defined(_AMD64_) || defined(__x86_64__) || defined(_X86_) || defined(__i386__) */ + return __builtin_bswap16(_Short); } -- 2.48.1 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public