summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2018-04-09 12:41:47 +0200
committerGitHub <noreply@github.com>2018-04-09 12:41:47 +0200
commite6349f5df343ef089ffadcbc6448ca5f9f2eb5d2 (patch)
tree73f74cfccbaa007ca0e26ca2aaf429d9636c0096
parent7374b0209e7ac3b6e22bfd86246d02f419d6fbb4 (diff)
parent85cc6bae8a7187b9b5a4c41264aea2f9d8620922 (diff)
downloadATCD-e6349f5df343ef089ffadcbc6448ca5f9f2eb5d2.tar.gz
Merge pull request #610 from jwillemsen/jwi-builtinbswap
Make use of builtin_bswap(16|32|64) with Embarcadero C++ Builder clang
-rw-r--r--ACE/ace/CDR_Base.inl9
-rw-r--r--ACE/ace/config-win32-borland.h3
-rw-r--r--ACE/tests/CDR_Array_Test.cpp16
3 files changed, 20 insertions, 8 deletions
diff --git a/ACE/ace/CDR_Base.inl b/ACE/ace/CDR_Base.inl
index 24000ac669e..c31c3b78555 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));
@@ -100,6 +103,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 +141,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__ */
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
@@ -969,14 +969,6 @@ run_main (int argc, ACE_TCHAR *argv[])
for (use_array = 0; use_array < 2; use_array++)
{
{
- CDR_Test<ACE_CDR::Double, DoubleHelper>
- test (dtotal, niter, use_array);
- }
- {
- CDR_Test<ACE_CDR::Float, FloatHelper>
- test (ftotal, niter, use_array);
- }
- {
CDR_Test<ACE_CDR::LongLong, LongLongHelper>
test (qtotal, niter, use_array);
}
@@ -992,6 +984,14 @@ run_main (int argc, ACE_TCHAR *argv[])
CDR_Test<ACE_CDR::Char, CharHelper>
test (ctotal, niter, use_array);
}
+ {
+ CDR_Test<ACE_CDR::Double, DoubleHelper>
+ test (dtotal, niter, use_array);
+ }
+ {
+ CDR_Test<ACE_CDR::Float, FloatHelper>
+ test (ftotal, niter, use_array);
+ }
}
ACE_END_TEST;