2 * Written by Josh Dybnis and released to the public domain, as explained at
3 * http://creativecommons.org/licenses/publicdomain
12 #include <sys/types.h>
14 #define MAX_NUM_THREADS 4 // make this whatever you want, but make it a power of 2
16 #define CACHE_LINE_SIZE 64
18 #define EXPECT_TRUE(x) __builtin_expect(x, 1)
19 #define EXPECT_FALSE(x) __builtin_expect(x, 0)
21 #define SYNC_SWAP __sync_lock_test_and_set
22 #define SYNC_CAS __sync_val_compare_and_swap
23 #define SYNC_ADD __sync_add_and_fetch
24 #define SYNC_FETCH_AND_OR __sync_fetch_and_or
26 #define MASK(n) ((1ULL << (n)) - 1)
32 #define TAG1 (1U << 31)
33 #define TAG2 (1U << 30)
35 #define TAG1 (1ULL << 63)
36 #define TAG2 (1ULL << 62)
38 #define TAG_VALUE(v, tag) ((v) | tag)
39 #define IS_TAGGED(v, tag) ((v) & tag)
40 #define STRIP_TAG(v, tag) ((v) & ~tag)
42 #define DOES_NOT_EXIST 0
43 #define ERROR_INVALID_OPTION (-1)
44 #define ERROR_INVALID_ARGUMENT (-2)
45 #define ERROR_UNSUPPORTED_FEATURE (-3)
46 #define ERROR_TXN_NOT_RUNNING (-4)
48 typedef unsigned long long uint64_t;
49 typedef unsigned int uint32_t;
50 typedef unsigned char uint8_t;
52 typedef size_t markable_t;