prefix.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (C) 2009, 2016 Tim Blechmann
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
  7. #define BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
  8. #include <boost/predef.h>
  9. /* this file defines the following macros:
  10. BOOST_LOCKFREE_PTR_COMPRESSION: use tag/pointer compression to utilize parts
  11. of the virtual address space as tag (at least 16bit)
  12. */
  13. namespace boost { namespace lockfree { namespace detail {
  14. #ifdef __cpp_inline_variables
  15. # define inline_constexpr inline
  16. #else
  17. # define inline_constexpr
  18. #endif
  19. #if BOOST_ARCH_SYS390
  20. inline_constexpr constexpr size_t cacheline_bytes = 256;
  21. #elif BOOST_ARCH_PPC
  22. inline_constexpr constexpr size_t cacheline_bytes = 128;
  23. #elif BOOST_ARCH_ARM && ( BOOST_OS_MACOS || BOOST_OS_IOS )
  24. // technically this is for apple's the M chips, but the A chip are probably similar
  25. inline_constexpr constexpr size_t cacheline_bytes = 128;
  26. #else
  27. inline_constexpr constexpr size_t cacheline_bytes = 64;
  28. #endif
  29. }}} // namespace boost::lockfree::detail
  30. #if BOOST_ARCH_X86_64 || ( ( BOOST_ARCH_ARM >= BOOST_VERSION_NUMBER( 8, 0, 0 ) ) && !BOOST_PLAT_ANDROID )
  31. # define BOOST_LOCKFREE_PTR_COMPRESSION 1
  32. #endif
  33. #undef inline_constexpr
  34. #endif /* BOOST_LOCKFREE_PREFIX_HPP_INCLUDED */