From 95fff62248ae45054a36ffc3b569a34b86c6d151 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 9 Apr 2018 08:15:19 +0100 Subject: Make use of builtin_bswap(16|32|64) --- ACE/ace/CDR_Base.inl | 11 +++++++++++ ACE/ace/config-win32-borland.h | 3 +++ 2 files changed, 14 insertions(+) diff --git a/ACE/ace/CDR_Base.inl b/ACE/ace/CDR_Base.inl index 24000ac669e..40b3500cfdd 100644 --- a/ACE/ace/CDR_Base.inl +++ b/ACE/ace/CDR_Base.inl @@ -66,6 +66,9 @@ ACE_CDR::swap_2 (const char *orig, char* target) // function. *reinterpret_cast (target) = _byteswap_ushort (*reinterpret_cast (orig)); +#elif defined (ACE_HAS_BUILTIN_BSWAP16) + *reinterpret_cast (target) = + __builtin_bswap16 (*reinterpret_cast (orig)); #elif defined (ACE_HAS_BSWAP16) *reinterpret_cast (target) = bswap16 (*reinterpret_cast (orig)); @@ -80,6 +83,8 @@ ACE_CDR::swap_2 (const char *orig, char* target) #elif defined (ACE_HAS_PENTIUM) \ && (defined(_MSC_VER) || defined(__BORLANDC__)) \ && !defined(ACE_LACKS_INLINE_ASSEMBLY) + + ss __asm mov ebx, orig; __asm mov ecx, target; __asm mov ax, [ebx]; @@ -100,6 +105,9 @@ ACE_CDR::swap_4 (const char* orig, char* target) // function. *reinterpret_cast (target) = _byteswap_ulong (*reinterpret_cast (orig)); +#elif defined (ACE_HAS_BUILTIN_BSWAP32) + *reinterpret_cast (target) = + __builtin_bswap32 (*reinterpret_cast (orig)); #elif defined (ACE_HAS_BSWAP32) *reinterpret_cast (target) = bswap32 (*reinterpret_cast (orig)); @@ -135,6 +143,9 @@ ACE_CDR::swap_8 (const char* orig, char* target) // function. *reinterpret_cast (target) = _byteswap_uint64 (*reinterpret_cast (orig)); +#elif defined (ACE_HAS_BUILTIN_BSWAP64) + *reinterpret_cast (target) = + __builtin_bswap64 (*reinterpret_cast (orig)); #elif defined (ACE_HAS_BSWAP64) *reinterpret_cast (target) = bswap64 (*reinterpret_cast (orig)); diff --git a/ACE/ace/config-win32-borland.h b/ACE/ace/config-win32-borland.h index 25333940e55..6a1f3dee4ae 100644 --- a/ACE/ace/config-win32-borland.h +++ b/ACE/ace/config-win32-borland.h @@ -186,6 +186,9 @@ #ifdef __clang__ # define ACE_ANY_OPS_USE_NAMESPACE +# define ACE_HAS_BUILTIN_BSWAP16 +# define ACE_HAS_BUILTIN_BSWAP32 +# define ACE_HAS_BUILTIN_BSWAP64 #endif /* __clang__ */ -- cgit v1.2.1 From e9839d1b9f1d42cd15aaabb04fe015eb25bee9e3 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 9 Apr 2018 09:20:19 +0200 Subject: Test double/float as last, they are more complex so could easier fail * ACE/tests/CDR_Array_Test.cpp: --- ACE/tests/CDR_Array_Test.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ACE/tests/CDR_Array_Test.cpp b/ACE/tests/CDR_Array_Test.cpp index 2cb5467a68c..ed088cf2c29 100644 --- a/ACE/tests/CDR_Array_Test.cpp +++ b/ACE/tests/CDR_Array_Test.cpp @@ -968,14 +968,6 @@ run_main (int argc, ACE_TCHAR *argv[]) int use_array; for (use_array = 0; use_array < 2; use_array++) { - { - CDR_Test - test (dtotal, niter, use_array); - } - { - CDR_Test - test (ftotal, niter, use_array); - } { CDR_Test test (qtotal, niter, use_array); @@ -992,6 +984,14 @@ run_main (int argc, ACE_TCHAR *argv[]) CDR_Test test (ctotal, niter, use_array); } + { + CDR_Test + test (dtotal, niter, use_array); + } + { + CDR_Test + test (ftotal, niter, use_array); + } } ACE_END_TEST; -- cgit v1.2.1 From 85cc6bae8a7187b9b5a4c41264aea2f9d8620922 Mon Sep 17 00:00:00 2001 From: Johnny Willemsen Date: Mon, 9 Apr 2018 10:33:37 +0200 Subject: Removed accidental change * ACE/ace/CDR_Base.inl: --- ACE/ace/CDR_Base.inl | 2 -- 1 file changed, 2 deletions(-) diff --git a/ACE/ace/CDR_Base.inl b/ACE/ace/CDR_Base.inl index 40b3500cfdd..c31c3b78555 100644 --- a/ACE/ace/CDR_Base.inl +++ b/ACE/ace/CDR_Base.inl @@ -83,8 +83,6 @@ ACE_CDR::swap_2 (const char *orig, char* target) #elif defined (ACE_HAS_PENTIUM) \ && (defined(_MSC_VER) || defined(__BORLANDC__)) \ && !defined(ACE_LACKS_INLINE_ASSEMBLY) - - ss __asm mov ebx, orig; __asm mov ecx, target; __asm mov ax, [ebx]; -- cgit v1.2.1