SDL_stdlib.c File Reference
`#include "../SDL_internal.h"`
`#include "SDL_stdinc.h"`
`#include "../libm/math_libm.h"`
Include dependency graph for SDL_stdlib.c:

Go to the source code of this file.

## Functions

double | SDL_atan (double x)
double | SDL_atan2 (double x, double y)
double | SDL_acos (double val)
double | SDL_asin (double val)
double | SDL_ceil (double x)
double | SDL_copysign (double x, double y)
double | SDL_cos (double x)
float | SDL_cosf (float x)
double | SDL_fabs (double x)
double | SDL_floor (double x)
double | SDL_log (double x)
double | SDL_pow (double x, double y)
double | SDL_scalbn (double x, int n)
double | SDL_sin (double x)
float | SDL_sinf (float x)
double | SDL_sqrt (double x)
float | SDL_sqrtf (float x)
double | SDL_tan (double x)
float | SDL_tanf (float x)
int | SDL_abs (int x)
int | SDL_isdigit (int x)
int | SDL_isspace (int x)
int | SDL_toupper (int x)
int | SDL_tolower (int x)

## Function Documentation

int SDL_abs | ( | int | x | ) |

Definition at line 249 of file SDL_stdlib.c.

References SDL_isdigit(), SDL_isspace(), SDL_tolower(), and SDL_toupper().

{
#ifdef HAVE_ABS
return abs(x);
#else
return ((x) < 0 ? -(x) : (x));
#endif
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567

double SDL_acos | ( | double | val | ) |

Definition at line 55 of file SDL_stdlib.c.

References SDL_atan(), and SDL_sqrt().

Referenced by SDL_asin(), and SDL_memset4().

{
#if defined(HAVE_ACOS)
return acos(val);
#else
double result;
if (val == -1.0) {
result = M_PI;
} else {
result = SDL_atan(SDL_sqrt(1.0 - val * val) / val);
if (result < 0.0)
{
result += M_PI;
}
}
return result;
#endif
}
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
SDL_sqrt
double SDL_sqrt(double x)
Definition: SDL_stdlib.c:210
SDL_atan
double SDL_atan(double x)
Definition: SDL_stdlib.c:35
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1492

double SDL_asin | ( | double | val | ) |

Definition at line 75 of file SDL_stdlib.c.

References SDL_acos().

Referenced by SDL_memset4().

{
#if defined(HAVE_ASIN)
return asin(val);
#else
double result;
if (val == -1.0) {
result = -(M_PI / 2.0);
} else {
result = (M_PI / 2.0) - SDL_acos(val);
}
return result;
#endif
}
result
GLuint64EXT * result
Definition: SDL_opengl_glext.h:9432
SDL_acos
double SDL_acos(double val)
Definition: SDL_stdlib.c:55
val
GLuint GLfloat * val
Definition: SDL_opengl_glext.h:1492

double SDL_atan | ( | double | x | ) |

Definition at line 35 of file SDL_stdlib.c.

References atan(), and SDL_uclibc_atan().

Referenced by SDL_acos(), and SDL_memset4().

{
#ifdef HAVE_ATAN
return atan(x);
#else
return SDL_uclibc_atan(x);
#endif /* HAVE_ATAN */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_atan
double SDL_uclibc_atan(double x)
atan
double atan(double x)
Definition: s_atan.c:67

double SDL_atan2 | ( | double | x,
|  | double | y
| ) |  |

Definition at line 45 of file SDL_stdlib.c.

References SDL_uclibc_atan2().

Referenced by SDL_memset4().

{
#if defined(HAVE_ATAN2)
return atan2(x, y);
#else
return SDL_uclibc_atan2(x, y);
#endif /* HAVE_ATAN2 */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_atan2
double SDL_uclibc_atan2(double y, double x)
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567

double SDL_ceil | ( | double | x | ) |

Definition at line 91 of file SDL_stdlib.c.

References SDL_floor().

Referenced by SDL_memset4().

{
#ifdef HAVE_CEIL
return ceil(x);
#else
double integer = SDL_floor(x);
double fraction = x - integer;
if (fraction > 0.0) {
integer += 1.0;
}
return integer;
#endif /* HAVE_CEIL */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_floor
double SDL_floor(double x)
Definition: SDL_stdlib.c:148

double SDL_copysign | ( | double | x,
|  | double | y
| ) |  |

Definition at line 106 of file SDL_stdlib.c.

References copysign, and SDL_uclibc_copysign().

Referenced by SDL_memset4().

{
#if defined(HAVE_COPYSIGN)
return copysign(x, y);
#elif defined(HAVE__COPYSIGN)
return _copysign(x, y);
#else
return SDL_uclibc_copysign(x, y);
#endif /* HAVE_COPYSIGN */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_copysign
double SDL_uclibc_copysign(double x, double y)
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567
copysign
#define copysign
Definition: math_private.h:34

double SDL_cos | ( | double | x | ) |

Definition at line 118 of file SDL_stdlib.c.

References cos, and SDL_uclibc_cos().

Referenced by SDL_cosf(), and SDL_memset4().

{
#if defined(HAVE_COS)
return cos(x);
#else
return SDL_uclibc_cos(x);
#endif /* HAVE_COS */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
cos
#define cos
Definition: math_private.h:35
SDL_uclibc_cos
double SDL_uclibc_cos(double x)

float SDL_cosf | ( | float | x | ) |

Definition at line 128 of file SDL_stdlib.c.

References SDL_cos().

Referenced by SDL_memset4().

{
#ifdef HAVE_COSF
return cosf(x);
#else
return (float)SDL_cos((double)x);
#endif
}
SDL_cos
double SDL_cos(double x)
Definition: SDL_stdlib.c:118
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567

double SDL_fabs | ( | double | x | ) |

Definition at line 138 of file SDL_stdlib.c.

References fabs, and SDL_uclibc_fabs().

Referenced by SDL_memset4().

{
#if defined(HAVE_FABS)
return fabs(x);
#else
return SDL_uclibc_fabs(x);
#endif /* HAVE_FABS */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_fabs
double SDL_uclibc_fabs(double x)
fabs
#define fabs
Definition: math_private.h:36

double SDL_floor | ( | double | x | ) |

Definition at line 148 of file SDL_stdlib.c.

References floor, and SDL_uclibc_floor().

Referenced by SDL_ceil(), and SDL_memset4().

{
#if defined(HAVE_FLOOR)
return floor(x);
#else
return SDL_uclibc_floor(x);
#endif /* HAVE_FLOOR */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_floor
double SDL_uclibc_floor(double x)
floor
#define floor
Definition: math_private.h:37

int SDL_isdigit | ( | int | x | ) |

Definition at line 264 of file SDL_stdlib.c.

Referenced by SDL_abs().

{ return ((x) >= '0') && ((x) <= '9'); }
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567

int SDL_isspace | ( | int | x | ) |

Definition at line 265 of file SDL_stdlib.c.

Referenced by SDL_abs().

{ return ((x) == ' ') || ((x) == '\t') || ((x) == '\r') || ((x) == '\n') || ((x) == '\f') || ((x) == '\v'); }
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567

double SDL_log | ( | double | x | ) |

Definition at line 158 of file SDL_stdlib.c.

References SDL_uclibc_log().

Referenced by SDL_memset4().

{
#if defined(HAVE_LOG)
return log(x);
#else
return SDL_uclibc_log(x);
#endif /* HAVE_LOG */
}
SDL_uclibc_log
double SDL_uclibc_log(double x)
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567

double SDL_pow | ( | double | x,
|  | double | y
| ) |  |

Definition at line 168 of file SDL_stdlib.c.

References SDL_uclibc_pow().

Referenced by SDL_memset4().

{
#if defined(HAVE_POW)
return pow(x, y);
#else
return SDL_uclibc_pow(x, y);
#endif /* HAVE_POW */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_pow
double SDL_uclibc_pow(double x, double y)
y
GLint GLint GLint GLint GLint GLint y
Definition: SDL_opengl.h:1567

double SDL_scalbn | ( | double | x,
|  | int | n
| ) |  |

Definition at line 178 of file SDL_stdlib.c.

References scalbn, and SDL_uclibc_scalbn().

Referenced by SDL_memset4().

{
#if defined(HAVE_SCALBN)
return scalbn(x, n);
#elif defined(HAVE__SCALB)
return _scalb(x, n);
#else
return SDL_uclibc_scalbn(x, n);
#endif /* HAVE_SCALBN */
}
n
GLdouble n
Definition: SDL_opengl_glext.h:1952
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
scalbn
#define scalbn
Definition: math_private.h:40
SDL_uclibc_scalbn
double SDL_uclibc_scalbn(double x, int n)

double SDL_sin | ( | double | x | ) |

Definition at line 190 of file SDL_stdlib.c.

References SDL_uclibc_sin(), and sin.

Referenced by SDL_memset4(), and SDL_sinf().

{
#if defined(HAVE_SIN)
return sin(x);
#else
return SDL_uclibc_sin(x);
#endif /* HAVE_SIN */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_sin
double SDL_uclibc_sin(double x)
sin
#define sin
Definition: math_private.h:41

float SDL_sinf | ( | float | x | ) |

Definition at line 200 of file SDL_stdlib.c.

References SDL_sin().

Referenced by SDL_memset4().

{
#ifdef HAVE_SINF
return sinf(x);
#else
return (float)SDL_sin((double)x);
#endif /* HAVE_SINF */
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_sin
double SDL_sin(double x)
Definition: SDL_stdlib.c:190

double SDL_sqrt | ( | double | x | ) |

Definition at line 210 of file SDL_stdlib.c.

References SDL_uclibc_sqrt().

Referenced by SDL_acos(), SDL_memset4(), and SDL_sqrtf().

{
#if defined(HAVE_SQRT)
return sqrt(x);
#else
return SDL_uclibc_sqrt(x);
#endif
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_sqrt
double SDL_uclibc_sqrt(double x)

float SDL_sqrtf | ( | float | x | ) |

Definition at line 220 of file SDL_stdlib.c.

References SDL_sqrt().

Referenced by SDL_memset4().

{
#if defined(HAVE_SQRTF)
return sqrtf(x);
#else
return (float)SDL_sqrt((double)x);
#endif
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_sqrt
double SDL_sqrt(double x)
Definition: SDL_stdlib.c:210

double SDL_tan | ( | double | x | ) |

Definition at line 230 of file SDL_stdlib.c.

References SDL_uclibc_tan(), and tan().

Referenced by SDL_memset4(), and SDL_tanf().

{
#if defined(HAVE_TAN)
return tan(x);
#else
return SDL_uclibc_tan(x);
#endif
}
tan
double tan(double x)
Definition: s_tan.c:45
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_uclibc_tan
double SDL_uclibc_tan(double x)

float SDL_tanf | ( | float | x | ) |

Definition at line 240 of file SDL_stdlib.c.

References SDL_tan().

Referenced by SDL_memset4().

{
#if defined(HAVE_TANF)
return tanf(x);
#else
return (float)SDL_tan((double)x);
#endif
}
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567
SDL_tan
double SDL_tan(double x)
Definition: SDL_stdlib.c:230

int SDL_tolower | ( | int | x | ) |

Definition at line 267 of file SDL_stdlib.c.

References i, L1, L2, L3, L4, L5, L6, memcpy, and pop.

Referenced by SDL_abs().

{ return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) : (x); }
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567

int SDL_toupper | ( | int | x | ) |

Definition at line 266 of file SDL_stdlib.c.

Referenced by SDL_abs().

{ return ((x) >= 'a') && ((x) <= 'z') ? ('A'+((x)-'a')) : (x); }
x
GLint GLint GLint GLint GLint x
Definition: SDL_opengl.h:1567