1 // Copyright (C) 2009 Tim Blechmann
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)
7 #ifndef BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
8 #define BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
10 /* this file defines the following macros:
11 BOOST_LOCKFREE_CACHELINE_BYTES: size of a cache line
12 BOOST_LOCKFREE_PTR_COMPRESSION: use tag/pointer compression to utilize parts
13 of the virtual address space as tag (at least 16bit)
14 BOOST_LOCKFREE_DCAS_ALIGNMENT: symbol used for aligning structs at cache line
18 #define BOOST_LOCKFREE_CACHELINE_BYTES 64
22 #define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __declspec(align(BOOST_LOCKFREE_CACHELINE_BYTES))
25 #define BOOST_LOCKFREE_DCAS_ALIGNMENT
26 #elif defined(_M_X64) || defined(_M_IA64)
27 #define BOOST_LOCKFREE_PTR_COMPRESSION 1
28 #define BOOST_LOCKFREE_DCAS_ALIGNMENT __declspec(align(16))
35 #define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __attribute__((aligned(BOOST_LOCKFREE_CACHELINE_BYTES)))
37 #if defined(__i386__) || defined(__ppc__)
38 #define BOOST_LOCKFREE_DCAS_ALIGNMENT
39 #elif defined(__x86_64__)
40 #define BOOST_LOCKFREE_PTR_COMPRESSION 1
41 #define BOOST_LOCKFREE_DCAS_ALIGNMENT __attribute__((aligned(16)))
42 #elif defined(__alpha__)
43 // LATER: alpha may benefit from pointer compression. but what is the maximum size of the address space?
44 #define BOOST_LOCKFREE_DCAS_ALIGNMENT
48 #ifndef BOOST_LOCKFREE_DCAS_ALIGNMENT
49 #define BOOST_LOCKFREE_DCAS_ALIGNMENT /*BOOST_LOCKFREE_DCAS_ALIGNMENT*/
52 #ifndef BOOST_LOCKFREE_CACHELINE_ALIGNMENT
53 #define BOOST_LOCKFREE_CACHELINE_ALIGNMENT /*BOOST_LOCKFREE_CACHELINE_ALIGNMENT*/
56 #endif /* BOOST_LOCKFREE_PREFIX_HPP_INCLUDED */