string_ops.hpp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * http://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * Copyright (c) 2018 Andrey Semashev
  7. */
  8. /*!
  9. * \file atomic/detail/string_ops.hpp
  10. *
  11. * This header defines string operations for Boost.Atomic
  12. */
  13. #ifndef BOOST_ATOMIC_DETAIL_STRING_OPS_HPP_INCLUDED_
  14. #define BOOST_ATOMIC_DETAIL_STRING_OPS_HPP_INCLUDED_
  15. #include <boost/atomic/detail/config.hpp>
  16. #ifdef BOOST_HAS_PRAGMA_ONCE
  17. #pragma once
  18. #endif
  19. #if defined(__has_builtin)
  20. #if __has_builtin(__builtin_memcpy)
  21. #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
  22. #endif
  23. #if __has_builtin(__builtin_memcmp)
  24. #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
  25. #endif
  26. #if __has_builtin(__builtin_memset)
  27. #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMSET
  28. #endif
  29. #elif defined(BOOST_GCC)
  30. #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY
  31. #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP
  32. #define BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMSET
  33. #endif
  34. #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY)
  35. #define BOOST_ATOMIC_DETAIL_MEMCPY __builtin_memcpy
  36. #else
  37. #define BOOST_ATOMIC_DETAIL_MEMCPY std::memcpy
  38. #endif
  39. #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP)
  40. #define BOOST_ATOMIC_DETAIL_MEMCMP __builtin_memcmp
  41. #else
  42. #define BOOST_ATOMIC_DETAIL_MEMCMP std::memcmp
  43. #endif
  44. #if defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMSET)
  45. #define BOOST_ATOMIC_DETAIL_MEMSET __builtin_memset
  46. #else
  47. #define BOOST_ATOMIC_DETAIL_MEMSET std::memset
  48. #endif
  49. #if !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCPY) || !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMCMP) || !defined(BOOST_ATOMIC_DETAIL_HAS_BUILTIN_MEMSET)
  50. #include <cstring>
  51. #endif
  52. #endif // BOOST_ATOMIC_DETAIL_STRING_OPS_HPP_INCLUDED_