From 40cb4bf236a56328ee60978166334828ee726c12 Mon Sep 17 00:00:00 2001 From: rakslice Date: Tue, 17 Mar 2020 18:46:40 -0700 Subject: [PATCH] implementing bswap_16 to avoid incorrect result from cygwin 1.7 gcc 3.4.4 built dyngen for lhz --- SheepShaver/src/Windows/sysdeps.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/SheepShaver/src/Windows/sysdeps.h b/SheepShaver/src/Windows/sysdeps.h index 432b7e57..0d73d2bd 100755 --- a/SheepShaver/src/Windows/sysdeps.h +++ b/SheepShaver/src/Windows/sysdeps.h @@ -149,6 +149,19 @@ static inline uint32 do_opt_bswap_32(uint32 x) __asm__ __volatile__ ("bswap %0" : "=r" (v) : "0" (x)); return v; } + +#if defined(__CYGWIN__) || defined(__MINGW32__) + +#define opt_bswap_16 do_opt_bswap_16 +static inline uint16 do_opt_bswap_16(uint16 x) +{ + uint16 v; + __asm__ __volatile__ ("rolw $8, %0" : "=r" (v) : "0" (x)); + return v; +} + +#endif + #endif #endif