#include <stdio.h>
#include "SDL.h"
Go to the source code of this file.
|
static int | badsize (size_t sizeoftype, size_t hardcodetype) |
|
int | TestTypes (SDL_bool verbose) |
|
int | TestEndian (SDL_bool verbose) |
|
static int | TST_allmul (void *a, void *b, int arg, void *result, void *expected) |
|
static int | TST_alldiv (void *a, void *b, int arg, void *result, void *expected) |
|
static int | TST_allrem (void *a, void *b, int arg, void *result, void *expected) |
|
static int | TST_ualldiv (void *a, void *b, int arg, void *result, void *expected) |
|
static int | TST_uallrem (void *a, void *b, int arg, void *result, void *expected) |
|
static int | TST_allshl (void *a, void *b, int arg, void *result, void *expected) |
|
static int | TST_aullshl (void *a, void *b, int arg, void *result, void *expected) |
|
static int | TST_allshr (void *a, void *b, int arg, void *result, void *expected) |
|
static int | TST_aullshr (void *a, void *b, int arg, void *result, void *expected) |
|
int | Test64Bit (SDL_bool verbose) |
|
int | TestCPUInfo (SDL_bool verbose) |
|
int | TestAssertions (SDL_bool verbose) |
|
int | main (int argc, char *argv[]) |
|
◆ LL_Intrinsic
◆ badsize()
static int badsize |
( |
size_t |
sizeoftype, |
|
|
size_t |
hardcodetype |
|
) |
| |
|
static |
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 420 of file testplatform.c.
428 if (argv[1] && (
SDL_strcmp(argv[1],
"-q") == 0)) {
References SDL_FALSE, SDL_GetPlatform, SDL_Log, SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, SDL_LogSetPriority, SDL_strcmp, SDL_TRUE, Test64Bit(), TestAssertions(), TestCPUInfo(), TestEndian(), and TestTypes().
◆ Test64Bit()
Definition at line 342 of file testplatform.c.
348 unsigned long long result = 0;
349 unsigned int *al = (
unsigned int *)&
t->a;
350 unsigned int *bl = (
unsigned int *)&
t->b;
351 unsigned int *el = (
unsigned int *)&
t->expected_result;
352 unsigned int *rl = (
unsigned int *)&
result;
354 if (!
t->routine(&
t->a, &
t->b,
t->arg, &
result, &
t->expected_result)) {
356 SDL_Log(
"%s(0x%08X%08X, 0x%08X%08X, %3d, produced: 0x%08X%08X, expected: 0x%08X%08X\n",
357 t->operation, al[1], al[0], bl[1], bl[0],
t->arg, rl[1], rl[0], el[1], el[0]);
361 if (verbose && (failed == 0))
362 SDL_Log(
"All 64bit instrinsic tests passed\n");
363 return (failed ? 1 : 0);
References LL_Tests, NULL, LL_Test::routine, and SDL_Log.
Referenced by main().
◆ TestAssertions()
Definition at line 391 of file testplatform.c.
409 SDL_Log(
"'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
References SDL_AssertData::always_ignore, SDL_AssertData::condition, SDL_AssertData::filename, SDL_AssertData::function, SDL_AssertData::linenum, SDL_AssertData::next, SDL_assert, SDL_assert_paranoid, SDL_assert_release, SDL_GetAssertionReport, SDL_Log, and SDL_AssertData::trigger_count.
Referenced by main().
◆ TestCPUInfo()
Definition at line 367 of file testplatform.c.
References SDL_GetCPUCacheLineSize, SDL_GetCPUCount, SDL_GetSystemRAM, SDL_Has3DNow, SDL_HasAltiVec, SDL_HasAVX, SDL_HasAVX2, SDL_HasAVX512F, SDL_HasMMX, SDL_HasNEON, SDL_HasRDTSC, SDL_HasSSE, SDL_HasSSE2, SDL_HasSSE3, SDL_HasSSE41, SDL_HasSSE42, and SDL_Log.
Referenced by main().
◆ TestEndian()
Definition at line 84 of file testplatform.c.
91 Uint32 value32 = 0xEFBEADDE;
92 Uint32 swapped32 = 0xDEADBEEF;
97 value64 |= 0xCDAB3412;
98 swapped64 = 0x1234ABCD;
100 swapped64 |= 0xDEADBEEF;
103 SDL_Log(
"Detected a %s endian machine.\n",
106 if ((*((
char *) &
value) >> 4) == 0
x1) {
113 SDL_Log(
"Actually a %s endian machine!\n",
119 SDL_Log(
"Value 16 = 0x%X, swapped = 0x%X\n", value16,
124 SDL_Log(
"16 bit value swapped incorrectly!\n");
129 SDL_Log(
"Value 32 = 0x%X, swapped = 0x%X\n", value32,
134 SDL_Log(
"32 bit value swapped incorrectly!\n");
144 SDL_Log(
"64 bit value swapped incorrectly!\n");
148 return (error ? 1 : 0);
References SDL_BIG_ENDIAN, SDL_BYTEORDER, SDL_LIL_ENDIAN, SDL_Log, SDL_PRIX64, SDL_Swap16(), SDL_Swap32(), and SDL_Swap64().
Referenced by main().
◆ TestTypes()
Definition at line 29 of file testplatform.c.
55 SDL_Log(
"sizeof(Uint8) != 1, instead = %u\n",
56 (
unsigned int)
sizeof(
Uint8));
61 SDL_Log(
"sizeof(Uint16) != 2, instead = %u\n",
62 (
unsigned int)
sizeof(
Uint16));
67 SDL_Log(
"sizeof(Uint32) != 4, instead = %u\n",
68 (
unsigned int)
sizeof(
Uint32));
73 SDL_Log(
"sizeof(Uint64) != 8, instead = %u\n",
74 (
unsigned int)
sizeof(
Uint64));
77 if (verbose && !error)
78 SDL_Log(
"All data types are the expected size.\n");
80 return (error ? 1 : 0);
References badsize(), SDL_COMPILE_TIME_ASSERT, SDL_Log, SDL_MAX_SINT16, SDL_MAX_SINT32, SDL_MAX_SINT64, SDL_MAX_SINT8, SDL_MAX_UINT16, SDL_MAX_UINT32, SDL_MAX_UINT64, SDL_MAX_UINT8, SDL_MIN_SINT16, SDL_MIN_SINT32, SDL_MIN_SINT64, SDL_MIN_SINT8, SDL_MIN_UINT16, SDL_MIN_UINT32, SDL_MIN_UINT64, and SDL_MIN_UINT8.
Referenced by main().
◆ TST_alldiv()
static int TST_alldiv |
( |
void * |
a, |
|
|
void * |
b, |
|
|
int |
arg, |
|
|
void * |
result, |
|
|
void * |
expected |
|
) |
| |
|
static |
Definition at line 157 of file testplatform.c.
159 (*(
long long *)
result) = ((*(
long long *)
a) / (*(
long long *)
b));
160 return (*(
long long *)
result) == (*(
long long *)expected);
◆ TST_allmul()
static int TST_allmul |
( |
void * |
a, |
|
|
void * |
b, |
|
|
int |
arg, |
|
|
void * |
result, |
|
|
void * |
expected |
|
) |
| |
|
static |
Definition at line 151 of file testplatform.c.
153 (*(
long long *)
result) = ((*(
long long *)
a) * (*(
long long *)
b));
154 return (*(
long long *)
result) == (*(
long long *)expected);
◆ TST_allrem()
static int TST_allrem |
( |
void * |
a, |
|
|
void * |
b, |
|
|
int |
arg, |
|
|
void * |
result, |
|
|
void * |
expected |
|
) |
| |
|
static |
Definition at line 163 of file testplatform.c.
165 (*(
long long *)
result) = ((*(
long long *)
a) % (*(
long long *)
b));
166 return (*(
long long *)
result) == (*(
long long *)expected);
◆ TST_allshl()
static int TST_allshl |
( |
void * |
a, |
|
|
void * |
b, |
|
|
int |
arg, |
|
|
void * |
result, |
|
|
void * |
expected |
|
) |
| |
|
static |
Definition at line 181 of file testplatform.c.
183 (*(
long long *)
result) = (*(
long long *)
a) << arg;
184 return (*(
long long *)
result) == (*(
long long *)expected);
◆ TST_allshr()
static int TST_allshr |
( |
void * |
a, |
|
|
void * |
b, |
|
|
int |
arg, |
|
|
void * |
result, |
|
|
void * |
expected |
|
) |
| |
|
static |
Definition at line 193 of file testplatform.c.
195 (*(
long long *)
result) = (*(
long long *)
a) >> arg;
196 return (*(
long long *)
result) == (*(
long long *)expected);
◆ TST_aullshl()
static int TST_aullshl |
( |
void * |
a, |
|
|
void * |
b, |
|
|
int |
arg, |
|
|
void * |
result, |
|
|
void * |
expected |
|
) |
| |
|
static |
Definition at line 187 of file testplatform.c.
189 (*(
unsigned long long *)
result) = (*(
unsigned long long *)
a) << arg;
190 return (*(
unsigned long long *)
result) == (*(
unsigned long long *)expected);
◆ TST_aullshr()
static int TST_aullshr |
( |
void * |
a, |
|
|
void * |
b, |
|
|
int |
arg, |
|
|
void * |
result, |
|
|
void * |
expected |
|
) |
| |
|
static |
Definition at line 199 of file testplatform.c.
201 (*(
unsigned long long *)
result) = (*(
unsigned long long *)
a) >> arg;
202 return (*(
unsigned long long *)
result) == (*(
unsigned long long *)expected);
◆ TST_ualldiv()
static int TST_ualldiv |
( |
void * |
a, |
|
|
void * |
b, |
|
|
int |
arg, |
|
|
void * |
result, |
|
|
void * |
expected |
|
) |
| |
|
static |
Definition at line 169 of file testplatform.c.
171 (*(
unsigned long long *)
result) = ((*(
unsigned long long *)
a) / (*(
unsigned long long *)
b));
172 return (*(
unsigned long long *)
result) == (*(
unsigned long long *)expected);
◆ TST_uallrem()
static int TST_uallrem |
( |
void * |
a, |
|
|
void * |
b, |
|
|
int |
arg, |
|
|
void * |
result, |
|
|
void * |
expected |
|
) |
| |
|
static |
Definition at line 175 of file testplatform.c.
177 (*(
unsigned long long *)
result) = ((*(
unsigned long long *)
a) % (*(
unsigned long long *)
b));
178 return (*(
unsigned long long *)
result) == (*(
unsigned long long *)expected);
◆ LL_Tests
#define SDL_assert_paranoid(condition)
SDL_FORCE_INLINE Uint64 SDL_Swap64(Uint64 x)
@ SDL_LOG_CATEGORY_APPLICATION
GLboolean GLboolean GLboolean b
SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x)
#define SDL_MAX_UINT16
An unsigned 16-bit integer type.
GLuint GLfloat GLfloat GLfloat x1
GLboolean GLboolean GLboolean GLboolean a
#define SDL_assert_release(condition)
#define SDL_GetAssertionReport
#define SDL_COMPILE_TIME_ASSERT(name, x)
#define SDL_MAX_UINT8
An unsigned 8-bit integer type.
SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x)
#define SDL_MAX_SINT16
A signed 16-bit integer type.
#define SDL_MAX_SINT8
A signed 8-bit integer type.
#define SDL_assert(condition)
#define SDL_MAX_UINT64
An unsigned 64-bit integer type.
const struct SDL_AssertData * next
#define SDL_GetCPUCacheLineSize
#define SDL_LogSetPriority
GLsizei const GLfloat * value
#define SDL_MAX_SINT32
A signed 32-bit integer type.
unsigned int trigger_count
#define SDL_MAX_SINT64
A signed 64-bit integer type.
#define SDL_MAX_UINT32
An unsigned 32-bit integer type.