project_files/hwc/rtl/pmath.h
author sheepluva
Mon, 05 Aug 2019 00:20:45 +0200
changeset 15295 f382ec6dba11
parent 14197 3e551b0535fb
permissions -rw-r--r--
In hindsight my emscripten-ifdef (70d416a8f63f) is nonsense. As fpcrtl_glShaderSource() would not be defined and lead to compiling issues. So either it's 3 ifdefs (in pas2cRedo, pas2cSystem and misc.c), in order to toggle between fpcrtl_ and the native function, or alternatively have no ifdef for it at all. I'm going with none at all, which means emscripten will compile with the original (const) function prototype, being wrapped by the fpcrtl_ function, same as non-emscripten builds.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7983
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     1
#ifndef PMATH_H_
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     2
#define PMATH_H_
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     3
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     4
#include <stdint.h>
8047
25a4daa6473c cleanup headers, remove -I . from rtl lib to save a few warnings
koda
parents: 7983
diff changeset
     5
#include <math.h>
7983
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     6
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     7
#define     fpcrtl_min(a, b)                ((a) < (b) ? (a) : (b))
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     8
#define     fpcrtl_max(a, b)                ((a) > (b) ? (a) : (b))
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
     9
14197
3e551b0535fb Fix birdy appearance/disappearance animation
unc0rr
parents: 14185
diff changeset
    10
#define     fpcrtl_power(a, b)              pow(a, b)
7983
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    11
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    12
/* Currently the games only uses sign of an integer */
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    13
int         fpcrtl_signi(int x);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    14
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    15
float       fpcrtl_csc(float x);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    16
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    17
#define     fpcrtl_arctan2(y, x)            atan2(y, x)
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    18
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    19
float       __attribute__((overloadable))   fpcrtl_abs(float x);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    20
double      __attribute__((overloadable))   fpcrtl_abs(double x);
14185
801dc57371c3 Pas2C: Fix bad C typedefs for Pascal data types Extended and Real
Wuzzy <Wuzzy2@mail.ru>
parents: 11655
diff changeset
    21
long double __attribute__((overloadable))   fpcrtl_abs(long double x);
7983
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    22
int         __attribute__((overloadable))   fpcrtl_abs(int x);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    23
int64_t     __attribute__((overloadable))   fpcrtl_abs(int64_t x);
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    24
11655
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    25
/* emscripten cannot find math.h through our cmake */
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    26
#ifdef EMSCRIPTEN
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    27
double      exp(double);
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    28
double      log(double);
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    29
double      sin(double);
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    30
double      cos(double);
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    31
double      fabs(double);
14185
801dc57371c3 Pas2C: Fix bad C typedefs for Pascal data types Extended and Real
Wuzzy <Wuzzy2@mail.ru>
parents: 11655
diff changeset
    32
float       fabsf(float);
801dc57371c3 Pas2C: Fix bad C typedefs for Pascal data types Extended and Real
Wuzzy <Wuzzy2@mail.ru>
parents: 11655
diff changeset
    33
long double fabsl(long double);
11655
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    34
double      ceil(double);
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    35
double      sqrt(double);
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    36
double      atan(double);
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    37
double      atan2(double, double);
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    38
#endif
e15eb10f1703 Work around emscripten not finding math.h
koda
parents: 8047
diff changeset
    39
7983
02f36c3e7f6c add xymeng's rtl port
koda
parents:
diff changeset
    40
#endif /* PMATH_H_ */