diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2018-04-09 08:15:19 +0100 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2018-04-09 08:15:19 +0100 |
commit | 95fff62248ae45054a36ffc3b569a34b86c6d151 (patch) | |
tree | 227320fb897dd98ae5fa90defedb8c45596f4a82 | |
parent | 6f8b356f4acd034ff8996f515a81b789abeef715 (diff) | |
download | ATCD-95fff62248ae45054a36ffc3b569a34b86c6d151.tar.gz |
Make use of builtin_bswap(16|32|64)
-rw-r--r-- | ACE/ace/CDR_Base.inl | 11 | ||||
-rw-r--r-- | ACE/ace/config-win32-borland.h | 3 |
2 files changed, 14 insertions, 0 deletions
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<unsigned short *> (target) = _byteswap_ushort (*reinterpret_cast<unsigned short const *> (orig)); +#elif defined (ACE_HAS_BUILTIN_BSWAP16) + *reinterpret_cast<uint16_t *> (target) = + __builtin_bswap16 (*reinterpret_cast<uint16_t const *> (orig)); #elif defined (ACE_HAS_BSWAP16) *reinterpret_cast<uint16_t *> (target) = bswap16 (*reinterpret_cast<uint16_t const *> (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<unsigned long *> (target) = _byteswap_ulong (*reinterpret_cast<unsigned long const *> (orig)); +#elif defined (ACE_HAS_BUILTIN_BSWAP32) + *reinterpret_cast<uint32_t *> (target) = + __builtin_bswap32 (*reinterpret_cast<uint32_t const *> (orig)); #elif defined (ACE_HAS_BSWAP32) *reinterpret_cast<uint32_t *> (target) = bswap32 (*reinterpret_cast<uint32_t const *> (orig)); @@ -135,6 +143,9 @@ ACE_CDR::swap_8 (const char* orig, char* target) // function. *reinterpret_cast<unsigned __int64 *> (target) = _byteswap_uint64 (*reinterpret_cast<unsigned __int64 const *> (orig)); +#elif defined (ACE_HAS_BUILTIN_BSWAP64) + *reinterpret_cast<uint64_t *> (target) = + __builtin_bswap64 (*reinterpret_cast<uint64_t const *> (orig)); #elif defined (ACE_HAS_BSWAP64) *reinterpret_cast<uint64_t *> (target) = bswap64 (*reinterpret_cast<uint64_t const *> (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__ */ |