mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-05 07:09:32 +00:00
Use #ifdef/#ifndef instead of #if defined/#if \!defined
This commit is contained in:
committed by
Anonymous Maarten
parent
308bcbbe76
commit
b6ae281e97
@@ -193,7 +193,7 @@ static void kernel_doubles_add_cpu(double *dest, const double *a, const double *
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(SDL_MMX_INTRINSICS)
|
||||
#ifdef SDL_MMX_INTRINSICS
|
||||
SDL_TARGETING("mmx") static void kernel_ints_add_mmx(Sint32 *dest, const Sint32 *a, const Sint32 *b, size_t size) {
|
||||
for (; size >= 2; size -= 2, dest += 2, a += 2, b += 2) {
|
||||
*(__m64*)dest = _mm_add_pi32(*(__m64*)a, *(__m64*)b);
|
||||
@@ -205,7 +205,7 @@ SDL_TARGETING("mmx") static void kernel_ints_add_mmx(Sint32 *dest, const Sint32
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL_SSE_INTRINSICS)
|
||||
#ifdef SDL_SSE_INTRINSICS
|
||||
SDL_TARGETING("sse") static void kernel_floats_add_sse(float *dest, const float *a, const float *b, size_t size) {
|
||||
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
|
||||
_mm_storeu_ps(dest, _mm_add_ps(_mm_loadu_ps(a), _mm_loadu_ps (b)));
|
||||
@@ -216,7 +216,7 @@ SDL_TARGETING("sse") static void kernel_floats_add_sse(float *dest, const float
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL_SSE2_INTRINSICS)
|
||||
#ifdef SDL_SSE2_INTRINSICS
|
||||
SDL_TARGETING("sse2") static void kernel_doubles_add_sse2(double *dest, const double *a, const double *b, size_t size) {
|
||||
for (; size >= 2; size -= 2, dest += 2, a += 2, b += 2) {
|
||||
_mm_storeu_pd(dest, _mm_add_pd(_mm_loadu_pd(a), _mm_loadu_pd(b)));
|
||||
@@ -227,7 +227,7 @@ SDL_TARGETING("sse2") static void kernel_doubles_add_sse2(double *dest, const do
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL_SSE3_INTRINSICS)
|
||||
#ifdef SDL_SSE3_INTRINSICS
|
||||
SDL_TARGETING("sse3") static void kernel_ints_add_sse3(Sint32 *dest, const Sint32 *a, const Sint32 *b, size_t size) {
|
||||
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
|
||||
_mm_storeu_si128((__m128i*)dest, _mm_add_epi32(_mm_lddqu_si128((__m128i*)a), _mm_lddqu_si128((__m128i*)b)));
|
||||
@@ -238,7 +238,7 @@ SDL_TARGETING("sse3") static void kernel_ints_add_sse3(Sint32 *dest, const Sint3
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL_SSE4_1_INTRINSICS)
|
||||
#ifdef SDL_SSE4_1_INTRINSICS
|
||||
SDL_TARGETING("sse4.1") static void kernel_ints_mul_sse4_1(Sint32 *dest, const Sint32 *a, const Sint32 *b, size_t size) {
|
||||
for (; size >= 4; size -= 4, dest += 4, a += 4, b += 4) {
|
||||
_mm_storeu_si128((__m128i*)dest, _mm_mullo_epi32(_mm_lddqu_si128((__m128i*)a), _mm_lddqu_si128((__m128i*)b)));
|
||||
@@ -249,7 +249,7 @@ SDL_TARGETING("sse4.1") static void kernel_ints_mul_sse4_1(Sint32 *dest, const S
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL_SSE4_2_INTRINSICS)
|
||||
#ifdef SDL_SSE4_2_INTRINSICS
|
||||
SDL_TARGETING("sse4.2") static Uint32 calculate_crc32c_sse4_2(const char *text) {
|
||||
Uint32 crc32c = ~0;
|
||||
size_t len = SDL_strlen(text);
|
||||
@@ -280,7 +280,7 @@ SDL_TARGETING("sse4.2") static Uint32 calculate_crc32c_sse4_2(const char *text)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL_AVX_INTRINSICS)
|
||||
#ifdef SDL_AVX_INTRINSICS
|
||||
SDL_TARGETING("avx") static void kernel_floats_add_avx(float *dest, const float *a, const float *b, size_t size) {
|
||||
for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) {
|
||||
_mm256_storeu_ps(dest, _mm256_add_ps(_mm256_loadu_ps(a), _mm256_loadu_ps(b)));
|
||||
@@ -291,7 +291,7 @@ SDL_TARGETING("avx") static void kernel_floats_add_avx(float *dest, const float
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL_AVX2_INTRINSICS)
|
||||
#ifdef SDL_AVX2_INTRINSICS
|
||||
SDL_TARGETING("avx2") static void kernel_ints_add_avx2(Sint32 *dest, const Sint32 *a, const Sint32 *b, size_t size) {
|
||||
for (; size >= 8; size -= 8, dest += 8, a += 8, b += 8) {
|
||||
_mm256_storeu_si256((__m256i*)dest, _mm256_add_epi32(_mm256_loadu_si256((__m256i*)a), _mm256_loadu_si256((__m256i*)b)));
|
||||
@@ -302,7 +302,7 @@ SDL_TARGETING("avx2") static void kernel_ints_add_avx2(Sint32 *dest, const Sint3
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SDL_AVX512F_INTRINSICS)
|
||||
#ifdef SDL_AVX512F_INTRINSICS
|
||||
SDL_TARGETING("avx512f") static void kernel_floats_add_avx512f(float *dest, const float *a, const float *b, size_t size) {
|
||||
for (; size >= 16; size -= 16, dest += 16, a += 16, b += 16) {
|
||||
_mm512_storeu_ps(dest, _mm512_add_ps(_mm512_loadu_ps(a), _mm512_loadu_ps(b)));
|
||||
@@ -364,7 +364,7 @@ static int intrinsics_testMMX(void *arg)
|
||||
{
|
||||
if (SDL_HasMMX()) {
|
||||
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has MMX support.");
|
||||
#if defined(SDL_MMX_INTRINSICS)
|
||||
#ifdef SDL_MMX_INTRINSICS
|
||||
{
|
||||
size_t size;
|
||||
Sint32 *dest, *a, *b;
|
||||
@@ -392,7 +392,7 @@ static int intrinsics_testSSE(void *arg)
|
||||
{
|
||||
if (SDL_HasSSE()) {
|
||||
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE support.");
|
||||
#if defined(SDL_SSE_INTRINSICS)
|
||||
#ifdef SDL_SSE_INTRINSICS
|
||||
{
|
||||
size_t size;
|
||||
float *dest, *a, *b;
|
||||
@@ -420,7 +420,7 @@ static int intrinsics_testSSE2(void *arg)
|
||||
{
|
||||
if (SDL_HasSSE2()) {
|
||||
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE2 support.");
|
||||
#if defined(SDL_SSE2_INTRINSICS)
|
||||
#ifdef SDL_SSE2_INTRINSICS
|
||||
{
|
||||
size_t size;
|
||||
double *dest, *a, *b;
|
||||
@@ -448,7 +448,7 @@ static int intrinsics_testSSE3(void *arg)
|
||||
{
|
||||
if (SDL_HasSSE3()) {
|
||||
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE3 support.");
|
||||
#if defined(SDL_SSE3_INTRINSICS)
|
||||
#ifdef SDL_SSE3_INTRINSICS
|
||||
{
|
||||
size_t size;
|
||||
Sint32 *dest, *a, *b;
|
||||
@@ -476,7 +476,7 @@ static int intrinsics_testSSE4_1(void *arg)
|
||||
{
|
||||
if (SDL_HasSSE41()) {
|
||||
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE4.1 support.");
|
||||
#if defined(SDL_SSE4_1_INTRINSICS)
|
||||
#ifdef SDL_SSE4_1_INTRINSICS
|
||||
{
|
||||
size_t size;
|
||||
Sint32 *dest, *a, *b;
|
||||
@@ -504,7 +504,7 @@ static int intrinsics_testSSE4_2(void *arg)
|
||||
{
|
||||
if (SDL_HasSSE42()) {
|
||||
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has SSE4.2 support.");
|
||||
#if defined(SDL_SSE4_2_INTRINSICS)
|
||||
#ifdef SDL_SSE4_2_INTRINSICS
|
||||
{
|
||||
struct {
|
||||
const char *input;
|
||||
@@ -539,7 +539,7 @@ static int intrinsics_testAVX(void *arg)
|
||||
{
|
||||
if (SDL_HasAVX()) {
|
||||
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has AVX support.");
|
||||
#if defined(SDL_AVX_INTRINSICS)
|
||||
#ifdef SDL_AVX_INTRINSICS
|
||||
{
|
||||
size_t size;
|
||||
float *dest, *a, *b;
|
||||
@@ -567,7 +567,7 @@ static int intrinsics_testAVX2(void *arg)
|
||||
{
|
||||
if (SDL_HasAVX2()) {
|
||||
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has AVX2 support.");
|
||||
#if defined(SDL_AVX2_INTRINSICS)
|
||||
#ifdef SDL_AVX2_INTRINSICS
|
||||
{
|
||||
size_t size;
|
||||
Sint32 *dest, *a, *b;
|
||||
@@ -595,7 +595,7 @@ static int intrinsics_testAVX512F(void *arg)
|
||||
{
|
||||
if (SDL_HasAVX512F()) {
|
||||
SDLTest_AssertCheck(SDL_TRUE, "CPU of test machine has AVX512F support.");
|
||||
#if defined(SDL_AVX512F_INTRINSICS)
|
||||
#ifdef SDL_AVX512F_INTRINSICS
|
||||
{
|
||||
size_t size;
|
||||
float *dest, *a, *b;
|
||||
|
||||
@@ -357,7 +357,7 @@ static int platform_testSetErrorEmptyInput(void *arg)
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
#if defined(HAVE_WFORMAT_OVERFLOW)
|
||||
#ifdef HAVE_WFORMAT_OVERFLOW
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-overflow"
|
||||
#endif
|
||||
@@ -441,7 +441,7 @@ static int platform_testSetErrorInvalidInput(void *arg)
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
#if defined(HAVE_WFORMAT_OVERFLOW)
|
||||
#ifdef HAVE_WFORMAT_OVERFLOW
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ static int rwops_testFileRead(void *arg)
|
||||
}
|
||||
|
||||
/* Check type */
|
||||
#if defined(__ANDROID__)
|
||||
#ifdef __ANDROID__
|
||||
SDLTest_AssertCheck(
|
||||
rw->type == SDL_RWOPS_STDFILE || rw->type == SDL_RWOPS_JNIFILE,
|
||||
"Verify RWops type is SDL_RWOPS_STDFILE or SDL_RWOPS_JNIFILE; expected: %d|%d, got: %d", SDL_RWOPS_STDFILE, SDL_RWOPS_JNIFILE, rw->type);
|
||||
@@ -356,7 +356,7 @@ static int rwops_testFileWrite(void *arg)
|
||||
}
|
||||
|
||||
/* Check type */
|
||||
#if defined(__ANDROID__)
|
||||
#ifdef __ANDROID__
|
||||
SDLTest_AssertCheck(
|
||||
rw->type == SDL_RWOPS_STDFILE || rw->type == SDL_RWOPS_JNIFILE,
|
||||
"Verify RWops type is SDL_RWOPS_STDFILE or SDL_RWOPS_JNIFILE; expected: %d|%d, got: %d", SDL_RWOPS_STDFILE, SDL_RWOPS_JNIFILE, rw->type);
|
||||
|
||||
@@ -34,10 +34,10 @@ static int stdlib_strlcpy(void *arg)
|
||||
|
||||
#if defined(HAVE_WFORMAT) || defined(HAVE_WFORMAT_EXTRA_ARGS)
|
||||
#pragma GCC diagnostic push
|
||||
#if defined(HAVE_WFORMAT)
|
||||
#ifdef HAVE_WFORMAT
|
||||
#pragma GCC diagnostic ignored "-Wformat"
|
||||
#endif
|
||||
#if defined(HAVE_WFORMAT_EXTRA_ARGS)
|
||||
#ifdef HAVE_WFORMAT_EXTRA_ARGS
|
||||
#pragma GCC diagnostic ignored "-Wformat-extra-args"
|
||||
#endif
|
||||
#endif
|
||||
@@ -344,10 +344,10 @@ static int stdlib_getsetenv(void *arg)
|
||||
|
||||
#if defined(HAVE_WFORMAT) || defined(HAVE_WFORMAT_EXTRA_ARGS)
|
||||
#pragma GCC diagnostic push
|
||||
#if defined(HAVE_WFORMAT)
|
||||
#ifdef HAVE_WFORMAT
|
||||
#pragma GCC diagnostic ignored "-Wformat"
|
||||
#endif
|
||||
#if defined(HAVE_WFORMAT_EXTRA_ARGS)
|
||||
#ifdef HAVE_WFORMAT_EXTRA_ARGS
|
||||
#pragma GCC diagnostic ignored "-Wformat-extra-args"
|
||||
#endif
|
||||
#endif
|
||||
@@ -437,7 +437,7 @@ static int stdlib_sscanf(void *arg)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#if defined(_WIN64)
|
||||
#ifdef _WIN64
|
||||
#define SIZE_FORMAT "I64u"
|
||||
#elif defined(__WIN32__)
|
||||
#define SIZE_FORMAT "I32u"
|
||||
|
||||
@@ -332,7 +332,7 @@ int main(int argc, char *argv[])
|
||||
SDL_Log("%2.2f frames per second\n",
|
||||
((double)frames * 1000) / (now - then));
|
||||
}
|
||||
#if !defined(__ANDROID__)
|
||||
#ifndef __ANDROID__
|
||||
quit(0);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@@ -893,7 +893,7 @@ int main(int argc, char *argv[])
|
||||
SDL_Log("%2.2f frames per second\n",
|
||||
((double)frames * 1000) / (now - then));
|
||||
}
|
||||
#if !defined(__ANDROID__)
|
||||
#ifndef __ANDROID__
|
||||
quit(0);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@@ -780,7 +780,7 @@ int main(int argc, char *argv[])
|
||||
SDL_Log("%2.2f frames per second\n",
|
||||
((double)frames * 1000) / (now - then));
|
||||
}
|
||||
#if !defined(__ANDROID__)
|
||||
#ifndef __ANDROID__
|
||||
quit(0);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
@@ -99,7 +99,7 @@ Run(void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#ifndef _WIN32
|
||||
Uint32 hit_timeout(Uint32 interval, void *param) {
|
||||
SDL_Log("Hit timeout! Sending SIGINT!");
|
||||
kill(0, SIGINT);
|
||||
@@ -110,7 +110,7 @@ Uint32 hit_timeout(Uint32 interval, void *param) {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
#if !defined(_WIN32)
|
||||
#ifndef _WIN32
|
||||
int timeout = 0;
|
||||
#endif
|
||||
|
||||
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
|
||||
consumed = 2;
|
||||
}
|
||||
}
|
||||
#if !defined(_WIN32)
|
||||
#ifndef _WIN32
|
||||
} else if (SDL_strcmp(argv[i], "--timeout") == 0) {
|
||||
if (argv[i + 1]) {
|
||||
char *endptr;
|
||||
@@ -160,7 +160,7 @@ int main(int argc, char *argv[])
|
||||
static const char *options[] = {
|
||||
"[--nbthreads NB]",
|
||||
"[--worktime ms]",
|
||||
#if !defined(_WIN32)
|
||||
#ifndef _WIN32
|
||||
"[--timeout ms]",
|
||||
#endif
|
||||
NULL,
|
||||
@@ -201,7 +201,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(_WIN32)
|
||||
#ifndef _WIN32
|
||||
if (timeout) {
|
||||
SDL_AddTimer(timeout, hit_timeout, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user