Start of redesign, getting rid of 8 and 16 bit operations in .h and test files.
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403763
This commit is contained in:
parent
6f258c0f99
commit
96e3a0d5c7
2 changed files with 10 additions and 134 deletions
|
@ -52,38 +52,6 @@ extern "C" {
|
||||||
|
|
||||||
/* Function prototypes */
|
/* Function prototypes */
|
||||||
|
|
||||||
/* 8 bit atomic operations */
|
|
||||||
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_AtomicExchange8(volatile Uint8 * ptr, Uint8 value);
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet8(volatile Uint8 * ptr,
|
|
||||||
Uint8 oldvalue, Uint8 newvalue);
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet8(volatile Uint8 * ptr);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_AtomicClear8(volatile Uint8 * ptr);
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenIncrement8(volatile Uint8 * ptr);
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenDecrement8(volatile Uint8 * ptr);
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenAdd8(volatile Uint8 * ptr, Uint8 value);
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_AtomicFetchThenSubtract8(volatile Uint8 * ptr, Uint8 value);
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_AtomicIncrementThenFetch8(volatile Uint8 * ptr);
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_AtomicDecrementThenFetch8(volatile Uint8 * ptr);
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_AtomicAddThenFetch8(volatile Uint8 * ptr, Uint8 value);
|
|
||||||
extern DECLSPEC Uint8 SDLCALL SDL_AtomicSubtractThenFetch8(volatile Uint8 * ptr, Uint8 value);
|
|
||||||
|
|
||||||
/* 16 bit atomic operations */
|
|
||||||
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_AtomicExchange16(volatile Uint16 * ptr, Uint16 value);
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet16(volatile Uint16 * ptr,
|
|
||||||
Uint16 oldvalue, Uint16 newvalue);
|
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet16(volatile Uint16 * ptr);
|
|
||||||
extern DECLSPEC void SDLCALL SDL_AtomicClear16(volatile Uint16 * ptr);
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenIncrement16(volatile Uint16 * ptr);
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenDecrement16(volatile Uint16 * ptr);
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenAdd16(volatile Uint16 * ptr, Uint16 value);
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_AtomicFetchThenSubtract16(volatile Uint16 * ptr, Uint16 value);
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_AtomicIncrementThenFetch16(volatile Uint16 * ptr);
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_AtomicDecrementThenFetch16(volatile Uint16 * ptr);
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_AtomicAddThenFetch16(volatile Uint16 * ptr, Uint16 value);
|
|
||||||
extern DECLSPEC Uint16 SDLCALL SDL_AtomicSubtractThenFetch16(volatile Uint16 * ptr, Uint16 value);
|
|
||||||
|
|
||||||
/* 32 bit atomic operations */
|
/* 32 bit atomic operations */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,6 +69,7 @@ extern DECLSPEC Uint16 SDLCALL SDL_AtomicSubtractThenFetch16(volatile Uint16 * p
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicExchange32(volatile Uint32 * ptr, Uint32 value);
|
extern DECLSPEC Uint32 SDLCALL SDL_AtomicExchange32(volatile Uint32 * ptr, Uint32 value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn int SDL_AtomicCompareThenSet32(volatile Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
|
* \fn int SDL_AtomicCompareThenSet32(volatile Uint32 * ptr, Uint32 oldvalue, Uint32 newvalue)
|
||||||
*
|
*
|
||||||
|
@ -127,6 +96,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareThenSet32(volatile Uint32 * pt
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet32(volatile Uint32 * ptr);
|
extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet32(volatile Uint32 * ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn void SDL_AtomicClear32(volatile Uint32 * ptr);
|
* \fn void SDL_AtomicClear32(volatile Uint32 * ptr);
|
||||||
*
|
*
|
||||||
|
@ -136,6 +106,7 @@ extern DECLSPEC SDL_bool SDLCALL SDL_AtomicTestThenSet32(volatile Uint32 * ptr);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC void SDLCALL SDL_AtomicClear32(volatile Uint32 * ptr);
|
extern DECLSPEC void SDLCALL SDL_AtomicClear32(volatile Uint32 * ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Uint32 SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr);
|
* \fn Uint32 SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr);
|
||||||
*
|
*
|
||||||
|
@ -148,6 +119,7 @@ extern DECLSPEC void SDLCALL SDL_AtomicClear32(volatile Uint32 * ptr);
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr);
|
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenIncrement32(volatile Uint32 * ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Uint32 SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr);
|
* \fn Uint32 SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr);
|
||||||
*
|
*
|
||||||
|
@ -159,6 +131,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenIncrement32(volatile Uint32 *
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr);
|
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenDecrement32(volatile Uint32 * ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Uint32 SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value);
|
* \fn Uint32 SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value);
|
||||||
*
|
*
|
||||||
|
@ -171,6 +144,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenDecrement32(volatile Uint32 *
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value);
|
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, Uint32 value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Uint32 SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value);
|
* \fn Uint32 SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value);
|
||||||
*
|
*
|
||||||
|
@ -183,6 +157,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenAdd32(volatile Uint32 * ptr, U
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value);
|
extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenSubtract32(volatile Uint32 * ptr, Uint32 value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Uint32 SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr);
|
* \fn Uint32 SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr);
|
||||||
*
|
*
|
||||||
|
@ -194,6 +169,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_AtomicFetchThenSubtract32(volatile Uint32 * p
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr);
|
extern DECLSPEC Uint32 SDLCALL SDL_AtomicIncrementThenFetch32(volatile Uint32 * ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Uint32 SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr);
|
* \fn Uint32 SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr);
|
||||||
*
|
*
|
||||||
|
@ -205,6 +181,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_AtomicIncrementThenFetch32(volatile Uint32 *
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr);
|
extern DECLSPEC Uint32 SDLCALL SDL_AtomicDecrementThenFetch32(volatile Uint32 * ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Uint32 SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value);
|
* \fn Uint32 SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value);
|
||||||
*
|
*
|
||||||
|
@ -217,6 +194,7 @@ extern DECLSPEC Uint32 SDLCALL SDL_AtomicDecrementThenFetch32(volatile Uint32 *
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC Uint32 SDLCALL SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value);
|
extern DECLSPEC Uint32 SDLCALL SDL_AtomicAddThenFetch32(volatile Uint32 * ptr, Uint32 value);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \fn Uint32 SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value);
|
* \fn Uint32 SDL_AtomicSubtractThenFetch32(volatile Uint32 * ptr, Uint32 value);
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,12 +23,6 @@ int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
volatile Uint8 val8 = 0;
|
|
||||||
Uint8 ret8 = 0;
|
|
||||||
|
|
||||||
volatile Uint16 val16 = 0;
|
|
||||||
Uint16 ret16 = 0;
|
|
||||||
|
|
||||||
volatile Uint32 val32 = 0;
|
volatile Uint32 val32 = 0;
|
||||||
Uint32 ret32 = 0;
|
Uint32 ret32 = 0;
|
||||||
|
|
||||||
|
@ -37,102 +31,6 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
SDL_bool tfret = SDL_FALSE;
|
SDL_bool tfret = SDL_FALSE;
|
||||||
|
|
||||||
|
|
||||||
printf("8 bit -----------------------------------------\n\n");
|
|
||||||
|
|
||||||
ret8 = SDL_AtomicExchange8(&val8, 10);
|
|
||||||
printf("Exchange8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
ret8 = SDL_AtomicExchange8(&val8, 0);
|
|
||||||
printf("Exchange8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
|
|
||||||
val8 = 10;
|
|
||||||
tfret = SDL_AtomicCompareThenSet8(&val8, 10, 20);
|
|
||||||
printf("CompareThenSet8 tfret=%s val=%d\n", tf(tfret), val8);
|
|
||||||
val8 = 10;
|
|
||||||
tfret = SDL_AtomicCompareThenSet8(&val8, 0, 20);
|
|
||||||
printf("CompareThenSet8 tfret=%s val=%d\n", tf(tfret), val8);
|
|
||||||
|
|
||||||
val8 = 0;
|
|
||||||
tfret = SDL_AtomicTestThenSet8(&val8);
|
|
||||||
printf("TestThenSet8 tfret=%s val=%d\n", tf(tfret), val8);
|
|
||||||
tfret = SDL_AtomicTestThenSet8(&val8);
|
|
||||||
printf("TestThenSet8 tfret=%s val=%d\n", tf(tfret), val8);
|
|
||||||
|
|
||||||
SDL_AtomicClear8(&val8);
|
|
||||||
printf("Clear8 val=%d\n", val8);
|
|
||||||
|
|
||||||
ret8 = SDL_AtomicFetchThenIncrement8(&val8);
|
|
||||||
printf("FetchThenIncrement8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
|
|
||||||
ret8 = SDL_AtomicFetchThenDecrement8(&val8);
|
|
||||||
printf("FetchThenDecrement8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
|
|
||||||
ret8 = SDL_AtomicFetchThenAdd8(&val8, 10);
|
|
||||||
printf("FetchThenAdd8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
|
|
||||||
ret8 = SDL_AtomicFetchThenSubtract8(&val8, 10);
|
|
||||||
printf("FetchThenSubtract8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
|
|
||||||
ret8 = SDL_AtomicIncrementThenFetch8(&val8);
|
|
||||||
printf("IncrementThenFetch8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
|
|
||||||
ret8 = SDL_AtomicDecrementThenFetch8(&val8);
|
|
||||||
printf("DecrementThenFetch8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
|
|
||||||
ret8 = SDL_AtomicAddThenFetch8(&val8, 10);
|
|
||||||
printf("AddThenFetch8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
|
|
||||||
ret8 = SDL_AtomicSubtractThenFetch8(&val8, 10);
|
|
||||||
printf("SubtractThenFetch8 ret=%d val=%d\n", ret8, val8);
|
|
||||||
|
|
||||||
|
|
||||||
printf("16 bit -----------------------------------------\n\n");
|
|
||||||
|
|
||||||
ret16 = SDL_AtomicExchange16(&val16, 10);
|
|
||||||
printf("Exchange16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
ret16 = SDL_AtomicExchange16(&val16, 0);
|
|
||||||
printf("Exchange16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
|
|
||||||
val16 = 10;
|
|
||||||
tfret = SDL_AtomicCompareThenSet16(&val16, 10, 20);
|
|
||||||
printf("CompareThenSet16 tfret=%s val=%d\n", tf(tfret), val16);
|
|
||||||
val16 = 10;
|
|
||||||
tfret = SDL_AtomicCompareThenSet16(&val16, 0, 20);
|
|
||||||
printf("CompareThenSet16 tfret=%s val=%d\n", tf(tfret), val16);
|
|
||||||
|
|
||||||
val16 = 0;
|
|
||||||
tfret = SDL_AtomicTestThenSet16(&val16);
|
|
||||||
printf("TestThenSet16 tfret=%s val=%d\n", tf(tfret), val16);
|
|
||||||
tfret = SDL_AtomicTestThenSet16(&val16);
|
|
||||||
printf("TestThenSet16 tfret=%s val=%d\n", tf(tfret), val16);
|
|
||||||
|
|
||||||
SDL_AtomicClear16(&val16);
|
|
||||||
printf("Clear16 val=%d\n", val16);
|
|
||||||
|
|
||||||
ret16 = SDL_AtomicFetchThenIncrement16(&val16);
|
|
||||||
printf("FetchThenIncrement16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
|
|
||||||
ret16 = SDL_AtomicFetchThenDecrement16(&val16);
|
|
||||||
printf("FetchThenDecrement16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
|
|
||||||
ret16 = SDL_AtomicFetchThenAdd16(&val16, 10);
|
|
||||||
printf("FetchThenAdd16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
|
|
||||||
ret16 = SDL_AtomicFetchThenSubtract16(&val16, 10);
|
|
||||||
printf("FetchThenSubtract16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
|
|
||||||
ret16 = SDL_AtomicIncrementThenFetch16(&val16);
|
|
||||||
printf("IncrementThenFetch16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
|
|
||||||
ret16 = SDL_AtomicDecrementThenFetch16(&val16);
|
|
||||||
printf("DecrementThenFetch16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
|
|
||||||
ret16 = SDL_AtomicAddThenFetch16(&val16, 10);
|
|
||||||
printf("AddThenFetch16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
|
|
||||||
ret16 = SDL_AtomicSubtractThenFetch16(&val16, 10);
|
|
||||||
printf("SubtractThenFetch16 ret=%d val=%d\n", ret16, val16);
|
|
||||||
|
|
||||||
printf("32 bit -----------------------------------------\n\n");
|
printf("32 bit -----------------------------------------\n\n");
|
||||||
|
|
||||||
ret32 = SDL_AtomicExchange32(&val32, 10);
|
ret32 = SDL_AtomicExchange32(&val32, 10);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue