Test: Fix OS/2 compilation in math suite.

This commit is contained in:
Pierre Wendling 2022-05-10 22:55:41 -04:00 committed by Sam Lantinga
parent 43c22e5d1e
commit 2ec48b36ba
1 changed files with 12 additions and 3 deletions

View File

@ -35,6 +35,15 @@ typedef struct
/* ================= Test Helpers ================== */ /* ================= Test Helpers ================== */
/* OS/2 uses different function signatures for the helpers */
#ifdef __OS2__
typedef double(_Syscall *d_to_d_func)(double);
typedef double(_Syscall *dd_to_d_func)(double, double);
#else
typedef double (*d_to_d_func)(double);
typedef double (*dd_to_d_func)(double, double);
#endif
/** /**
* \brief Runs all the cases on a given function with a signature double -> double * \brief Runs all the cases on a given function with a signature double -> double
* *
@ -44,7 +53,7 @@ typedef struct
* \param cases_size, the size of the cases array. * \param cases_size, the size of the cases array.
*/ */
static int static int
helper_dtod(const char *func_name, double (*func)(double), helper_dtod(const char *func_name, d_to_d_func func,
const d_to_d *cases, const size_t cases_size) const d_to_d *cases, const size_t cases_size)
{ {
Uint32 i; Uint32 i;
@ -69,7 +78,7 @@ helper_dtod(const char *func_name, double (*func)(double),
* \param cases_size, the size of the cases array. * \param cases_size, the size of the cases array.
*/ */
static int static int
helper_ddtod(const char *func_name, double (*func)(double, double), helper_ddtod(const char *func_name, dd_to_d_func func,
const dd_to_d *cases, const size_t cases_size) const dd_to_d *cases, const size_t cases_size)
{ {
Uint32 i; Uint32 i;
@ -95,7 +104,7 @@ helper_ddtod(const char *func_name, double (*func)(double, double),
* \param func, the function to call. * \param func, the function to call.
*/ */
static int static int
helper_range(const char *func_name, double (*func)(double)) helper_range(const char *func_name, d_to_d_func func)
{ {
const Uint32 ITERATIONS = 10000000; const Uint32 ITERATIONS = 10000000;
const Uint32 STEP = SDL_MAX_UINT32 / ITERATIONS; const Uint32 STEP = SDL_MAX_UINT32 / ITERATIONS;