Disabling 64 bit atomics operations until I figure out why they do not link.
authorBob Pendleton <bob@pendleton.com>
Wed, 24 Jun 2009 22:24:23 +0000
changeset 3201c297230efc75
parent 3200 ef2c029a3a9d
child 3202 3aa519a5c676
Disabling 64 bit atomics operations until I figure out why they do not link.
src/atomic/linux/SDL_atomic.c
test/testatomic.c
     1.1 --- a/src/atomic/linux/SDL_atomic.c	Wed Jun 24 20:20:57 2009 +0000
     1.2 +++ b/src/atomic/linux/SDL_atomic.c	Wed Jun 24 22:24:23 2009 +0000
     1.3 @@ -20,8 +20,6 @@
     1.4      slouken@libsdl.org
     1.5  */
     1.6  
     1.7 -#ifdef SDL_ATOMIC_LINUX
     1.8 -
     1.9  #include "SDL.h"
    1.10  #include "SDL_config.h"
    1.11  #include "SDL_atomic.h"
    1.12 @@ -98,7 +96,8 @@
    1.13     return __sync_sub_and_fetch(ptr, value);
    1.14  }
    1.15  
    1.16 -#ifdef SDL_HAS_64BIT_TYPE
    1.17 +/* #ifdef SDL_HAS_64BIT_TYPE */
    1.18 +#if 0
    1.19  
    1.20  Uint64
    1.21  SDL_AtomicExchange64(Uint64 * ptr, Uint64 value)
    1.22 @@ -172,4 +171,3 @@
    1.23     return __sync_sub_and_fetch(ptr, value);
    1.24  }
    1.25  #endif
    1.26 -#endif
     2.1 --- a/test/testatomic.c	Wed Jun 24 20:20:57 2009 +0000
     2.2 +++ b/test/testatomic.c	Wed Jun 24 22:24:23 2009 +0000
     2.3 @@ -1,64 +1,51 @@
     2.4  #include "SDL.h"
     2.5  
     2.6 +/*
     2.7 +  Absolutely basic test just to see if we get the expected value after
     2.8 +  calling each function.
     2.9 +*/
    2.10 +
    2.11  int
    2.12  main(int argc, char **argv)
    2.13  {
    2.14 -/*     int rv = 10; */
    2.15 -/*     volatile int atomic; */
    2.16  
    2.17 -/*     SDL_atomic_int_set(&atomic, 10); */
    2.18 -/*     if (SDL_atomic_int_get(&atomic) != 10) */
    2.19 -/*         printf("Error: "); */
    2.20 -/*     printf("SDL_atomic_int_set(atomic, 10): atomic-> %d\n", */
    2.21 -/*            SDL_atomic_int_get(&atomic)); */
    2.22 +   Uint32 val32 = 0;
    2.23 +   Uint32 ret32 = 0;
    2.24  
    2.25 -/*     SDL_atomic_int_add(&atomic, 10); */
    2.26 -/*     if (SDL_atomic_int_get(&atomic) != 20) */
    2.27 -/*         printf("Error: "); */
    2.28 -/*     printf("SDL_atomic_int_add(atomic, 10): atomic-> %d\n", */
    2.29 -/*            SDL_atomic_int_get(&atomic)); */
    2.30 +   Uint64 val64 = 0;
    2.31 +   Uint64 ret64 = 0;
    2.32  
    2.33 -/*     rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); */
    2.34 -/*     if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 30) */
    2.35 -/*         printf("Error: "); */
    2.36 -/*     printf("SDL_atomic_int_cmp_xchg(atomic, 20, 30): rv-> %d, atomic-> %d\n", */
    2.37 -/*            rv, SDL_atomic_int_get(&atomic)); */
    2.38 +   SDL_bool tfval = SDL_FALSE;
    2.39  
    2.40 -/*     rv = SDL_atomic_int_cmp_xchg(&atomic, 20, 30); */
    2.41 -/*     if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 30) */
    2.42 -/*         printf("Error: "); */
    2.43 -/*     printf("SDL_atomic_int_cmp_xchg(atomic, 20, 40): rv-> %d, atomic-> %d\n", */
    2.44 -/*            rv, SDL_atomic_int_get(&atomic)); */
    2.45 +   ret32 = SDL_AtomicExchange32(&val32, 10);
    2.46 +   tfval = SDL_AtomicCompareThenSet32(&val32, 10, 20);
    2.47 +   tfval = SDL_AtomicTestThenSet32(&val32);
    2.48 +   SDL_AtomicClear32(&val32);
    2.49 +   ret32 = SDL_AtomicFetchThenIncrement32(&val32);
    2.50 +   ret32 = SDL_AtomicFetchThenDecrement32(&val32);
    2.51 +   ret32 = SDL_AtomicFetchThenAdd32(&val32, 10);
    2.52 +   ret32 = SDL_AtomicFetchThenSubtract32(&val32, 10);
    2.53 +   ret32 = SDL_AtomicIncrementThenFetch32(&val32);
    2.54 +   ret32 = SDL_AtomicDecrementThenFetch32(&val32);
    2.55 +   ret32 = SDL_AtomicAddThenFetch32(&val32, 10);
    2.56 +   ret32 = SDL_AtomicSubtractThenFetch32(&val32, 10);
    2.57  
    2.58 -/*     rv = SDL_atomic_int_xchg_add(&atomic, 10); */
    2.59 -/*     if (rv != 30 || SDL_atomic_int_get(&atomic) != 40) */
    2.60 -/*         printf("Error: "); */
    2.61 -/*     printf("SDL_atomic_int_xchg_add(atomic, 10): rv-> %d, atomic-> %d\n", */
    2.62 -/*            rv, SDL_atomic_int_get(&atomic)); */
    2.63 +/* #ifdef SDL_HAS_64BIT_TYPE */
    2.64 +#if 0
    2.65  
    2.66 -/*     SDL_atomic_int_inc(&atomic); */
    2.67 -/*     if (SDL_atomic_int_get(&atomic) != 41) */
    2.68 -/*         printf("Error: "); */
    2.69 -/*     printf("SDL_atomic_int_inc(atomic): atomic-> %d\n", */
    2.70 -/*            SDL_atomic_int_get(&atomic)); */
    2.71 +   ret64 = SDL_AtomicExchange64(&val64, 10);
    2.72 +   tfval = SDL_AtomicCompareThenSet64(&val64, 10, 20);
    2.73 +   tfval = SDL_AtomicTestThenSet64(&val64);
    2.74 +   SDL_AtomicClear64(&val64);
    2.75 +   ret64 = SDL_AtomicFetchThenIncrement64(&val64);
    2.76 +   ret64 = SDL_AtomicFetchThenDecrement64(&val64);
    2.77 +   ret64 = SDL_AtomicFetchThenAdd64(&val64, 10);
    2.78 +   ret64 = SDL_AtomicFetchThenSubtract64(&val64, 10);
    2.79 +   ret64 = SDL_AtomicIncrementThenFetch64(&val64);
    2.80 +   ret64 = SDL_AtomicDecrementThenFetch64(&val64);
    2.81 +   ret64 = SDL_AtomicAddThenFetch64(&val64, 10);
    2.82 +   ret64 = SDL_AtomicSubtractThenFetch64(&val64, 10);
    2.83 +#endif
    2.84  
    2.85 -/*     rv = SDL_atomic_int_dec_test(&atomic); */
    2.86 -/*     if (rv != SDL_FALSE || SDL_atomic_int_get(&atomic) != 40) */
    2.87 -/*         printf("Error: "); */
    2.88 -/*     printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", */
    2.89 -/*            rv, SDL_atomic_int_get(&atomic)); */
    2.90 -
    2.91 -/*     SDL_atomic_int_set(&atomic, 1); */
    2.92 -/*     if (SDL_atomic_int_get(&atomic) != 1) */
    2.93 -/*         printf("Error: "); */
    2.94 -/*     printf("SDL_atomic_int_set(atomic, 1): atomic-> %d\n", */
    2.95 -/*            SDL_atomic_int_get(&atomic)); */
    2.96 -
    2.97 -/*     rv = SDL_atomic_int_dec_test(&atomic); */
    2.98 -/*     if (rv != SDL_TRUE || SDL_atomic_int_get(&atomic) != 0) */
    2.99 -/*         printf("Error: "); */
   2.100 -/*     printf("SDL_atomic_int_dec_test(atomic): rv-> %d, atomic-> %d\n", */
   2.101 -/*            rv, SDL_atomic_int_get(&atomic)); */
   2.102 -
   2.103 -    return 0;
   2.104 -}
   2.105 +   return 0;
   2.106 +   }