annotate test/testatomic.c @ 3201:c297230efc75

Disabling 64 bit atomics operations until I figure out why they do not link.
author Bob Pendleton <bob@pendleton.com>
date Wed, 24 Jun 2009 22:24:23 +0000
parents 3e1bf2b8bd81
children 3aa519a5c676
rev   line source
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
1 #include "SDL.h"
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
2
3201
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
3 /*
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
4 Absolutely basic test just to see if we get the expected value after
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
5 calling each function.
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
6 */
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
7
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
8 int
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
9 main(int argc, char **argv)
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
10 {
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
11
3201
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
12 Uint32 val32 = 0;
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
13 Uint32 ret32 = 0;
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
14
3201
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
15 Uint64 val64 = 0;
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
16 Uint64 ret64 = 0;
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
17
3201
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
18 SDL_bool tfval = SDL_FALSE;
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
19
3201
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
20 ret32 = SDL_AtomicExchange32(&val32, 10);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
21 tfval = SDL_AtomicCompareThenSet32(&val32, 10, 20);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
22 tfval = SDL_AtomicTestThenSet32(&val32);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
23 SDL_AtomicClear32(&val32);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
24 ret32 = SDL_AtomicFetchThenIncrement32(&val32);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
25 ret32 = SDL_AtomicFetchThenDecrement32(&val32);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
26 ret32 = SDL_AtomicFetchThenAdd32(&val32, 10);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
27 ret32 = SDL_AtomicFetchThenSubtract32(&val32, 10);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
28 ret32 = SDL_AtomicIncrementThenFetch32(&val32);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
29 ret32 = SDL_AtomicDecrementThenFetch32(&val32);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
30 ret32 = SDL_AtomicAddThenFetch32(&val32, 10);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
31 ret32 = SDL_AtomicSubtractThenFetch32(&val32, 10);
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
32
3201
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
33 /* #ifdef SDL_HAS_64BIT_TYPE */
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
34 #if 0
3180
77d6336711fc First commit for SDL atomic operations.
Bob Pendleton <bob@pendleton.com>
parents:
diff changeset
35
3201
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
36 ret64 = SDL_AtomicExchange64(&val64, 10);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
37 tfval = SDL_AtomicCompareThenSet64(&val64, 10, 20);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
38 tfval = SDL_AtomicTestThenSet64(&val64);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
39 SDL_AtomicClear64(&val64);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
40 ret64 = SDL_AtomicFetchThenIncrement64(&val64);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
41 ret64 = SDL_AtomicFetchThenDecrement64(&val64);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
42 ret64 = SDL_AtomicFetchThenAdd64(&val64, 10);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
43 ret64 = SDL_AtomicFetchThenSubtract64(&val64, 10);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
44 ret64 = SDL_AtomicIncrementThenFetch64(&val64);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
45 ret64 = SDL_AtomicDecrementThenFetch64(&val64);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
46 ret64 = SDL_AtomicAddThenFetch64(&val64, 10);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
47 ret64 = SDL_AtomicSubtractThenFetch64(&val64, 10);
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
48 #endif
3186
Sam Lantinga <slouken@libsdl.org>
parents: 3180
diff changeset
49
3201
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
50 return 0;
c297230efc75 Disabling 64 bit atomics operations until I figure out why they do not link.
Bob Pendleton <bob@pendleton.com>
parents: 3199
diff changeset
51 }