test/testatomic.c
changeset 5115 427998ff3bcf
parent 5114 e337f792c6a7
child 5116 02b860cbc7ce
     1.1 --- a/test/testatomic.c	Thu Jan 27 15:31:00 2011 -0800
     1.2 +++ b/test/testatomic.c	Thu Jan 27 16:46:15 2011 -0800
     1.3 @@ -243,9 +243,6 @@
     1.4  #define NUM_WRITERS 4
     1.5  #define EVENTS_PER_WRITER   1000000
     1.6  
     1.7 -/* A decent guess for the size of a cache line on this architecture */
     1.8 -#define CACHELINE   64
     1.9 -
    1.10  /* The number of entries must be a power of 2 */
    1.11  #define MAX_ENTRIES 256
    1.12  #define WRAP_MASK   (MAX_ENTRIES-1)
    1.13 @@ -260,22 +257,22 @@
    1.14  {
    1.15      SDL_EventQueueEntry entries[MAX_ENTRIES];
    1.16  
    1.17 -    char cache_pad1[CACHELINE-((sizeof(SDL_EventQueueEntry)*MAX_ENTRIES)%CACHELINE)];
    1.18 +    char cache_pad1[SDL_CACHELINE_SIZE-((sizeof(SDL_EventQueueEntry)*MAX_ENTRIES)%SDL_CACHELINE_SIZE)];
    1.19  
    1.20      SDL_atomic_t enqueue_pos;
    1.21  
    1.22 -    char cache_pad2[CACHELINE-sizeof(SDL_atomic_t)];
    1.23 +    char cache_pad2[SDL_CACHELINE_SIZE-sizeof(SDL_atomic_t)];
    1.24  
    1.25      SDL_atomic_t dequeue_pos;
    1.26  
    1.27 -    char cache_pad3[CACHELINE-sizeof(SDL_atomic_t)];
    1.28 +    char cache_pad3[SDL_CACHELINE_SIZE-sizeof(SDL_atomic_t)];
    1.29  
    1.30  #ifdef TEST_SPINLOCK_FIFO
    1.31      SDL_SpinLock lock;
    1.32      SDL_atomic_t rwcount;
    1.33      SDL_atomic_t watcher;
    1.34  
    1.35 -    char cache_pad4[CACHELINE-sizeof(SDL_SpinLock)-2*sizeof(SDL_atomic_t)];
    1.36 +    char cache_pad4[SDL_CACHELINE_SIZE-sizeof(SDL_SpinLock)-2*sizeof(SDL_atomic_t)];
    1.37  #endif
    1.38  
    1.39      volatile SDL_bool active;
    1.40 @@ -470,10 +467,10 @@
    1.41  {
    1.42      SDL_EventQueue *queue;
    1.43      int index;
    1.44 -    char padding1[CACHELINE-(sizeof(SDL_EventQueue*)+sizeof(int))%CACHELINE];
    1.45 +    char padding1[SDL_CACHELINE_SIZE-(sizeof(SDL_EventQueue*)+sizeof(int))%SDL_CACHELINE_SIZE];
    1.46      int waits;
    1.47      SDL_bool lock_free;
    1.48 -    char padding2[CACHELINE-sizeof(int)-sizeof(SDL_bool)];
    1.49 +    char padding2[SDL_CACHELINE_SIZE-sizeof(int)-sizeof(SDL_bool)];
    1.50  } WriterData;
    1.51  
    1.52  typedef struct
    1.53 @@ -482,7 +479,7 @@
    1.54      int counters[NUM_WRITERS];
    1.55      int waits;
    1.56      SDL_bool lock_free;
    1.57 -    char padding[CACHELINE-(sizeof(SDL_EventQueue*)+sizeof(int)*NUM_WRITERS+sizeof(int)+sizeof(SDL_bool))%CACHELINE];
    1.58 +    char padding[SDL_CACHELINE_SIZE-(sizeof(SDL_EventQueue*)+sizeof(int)*NUM_WRITERS+sizeof(int)+sizeof(SDL_bool))%SDL_CACHELINE_SIZE];
    1.59  } ReaderData;
    1.60  
    1.61  static int FIFO_Writer(void* _data)