mirror of
https://github.com/HandmadeMath/HandmadeMath.git
synced 2025-09-08 19:28:17 +00:00
Add wrappers for expf and logf
This commit is contained in:
@@ -77,19 +77,23 @@
|
|||||||
#define HMM_SINF MySinF
|
#define HMM_SINF MySinF
|
||||||
#define HMM_COSF MyCosF
|
#define HMM_COSF MyCosF
|
||||||
#define HMM_TANF MyTanF
|
#define HMM_TANF MyTanF
|
||||||
|
#define HMM_EXPF MyExpF
|
||||||
|
#define HMM_LOGF MyLogF
|
||||||
|
|
||||||
Provide your own implementations of SinF, CosF, and TanF
|
Provide your own implementations of SinF, CosF, TanF, ExpF and LogF
|
||||||
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
in EXACTLY one C or C++ file that includes this header, BEFORE the
|
||||||
include, like this:
|
include, like this:
|
||||||
|
|
||||||
#define HMM_SINF MySinF
|
#define HMM_SINF MySinF
|
||||||
#define HMM_COSF MyCosF
|
#define HMM_COSF MyCosF
|
||||||
#define HMM_TANF MyTanF
|
#define HMM_TANF MyTanF
|
||||||
|
#define HMM_EXPF MyExpF
|
||||||
|
#define HMM_LOGF MyLogF
|
||||||
#define HANDMADE_MATH_IMPLEMENTATION
|
#define HANDMADE_MATH_IMPLEMENTATION
|
||||||
#define HANDMADE_MATH_CPP_MODE
|
#define HANDMADE_MATH_CPP_MODE
|
||||||
#include "HandmadeMath.h"
|
#include "HandmadeMath.h"
|
||||||
|
|
||||||
If you do not define all three of these, HandmadeMath.h will use the
|
If you do not define all five of these, HandmadeMath.h will use the
|
||||||
versions of these functions that are provided by the CRT.
|
versions of these functions that are provided by the CRT.
|
||||||
|
|
||||||
==========================================================================
|
==========================================================================
|
||||||
@@ -183,7 +187,8 @@ extern "C"
|
|||||||
#define HINLINE inline
|
#define HINLINE inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HMM_SINF) || !defined(HMM_COSF) || !defined(HMM_TANF)
|
#if !defined(HMM_SINF) || !defined(HMM_COSF) || !defined(HMM_TANF) || \
|
||||||
|
!defined(HMM_EXPF) || !defined(HMM_LOGF)
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -199,6 +204,14 @@ extern "C"
|
|||||||
#define HMM_TANF tanf
|
#define HMM_TANF tanf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HMM_EXPF
|
||||||
|
#define HMM_EXPF expf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HMM_LOGF
|
||||||
|
#define HMM_LOGF logf
|
||||||
|
#endif
|
||||||
|
|
||||||
#define HMM_PI32 3.14159265359f
|
#define HMM_PI32 3.14159265359f
|
||||||
#define HMM_PI 3.14159265358979323846
|
#define HMM_PI 3.14159265358979323846
|
||||||
|
|
||||||
@@ -338,6 +351,8 @@ typedef hmm_mat4 hmm_m4;
|
|||||||
HMMDEF float HMM_SinF(float Angle);
|
HMMDEF float HMM_SinF(float Angle);
|
||||||
HMMDEF float HMM_TanF(float Angle);
|
HMMDEF float HMM_TanF(float Angle);
|
||||||
HMMDEF float HMM_CosF(float Angle);
|
HMMDEF float HMM_CosF(float Angle);
|
||||||
|
HMMDEF float HMM_ExpF(float Float);
|
||||||
|
HMMDEF float HMM_LogF(float Float);
|
||||||
|
|
||||||
HMMDEF float HMM_ToRadians(float Degrees);
|
HMMDEF float HMM_ToRadians(float Degrees);
|
||||||
HMMDEF float HMM_SquareRootF(float Float);
|
HMMDEF float HMM_SquareRootF(float Float);
|
||||||
@@ -538,6 +553,24 @@ HMM_TanF(float Radians)
|
|||||||
return (Result);
|
return (Result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HINLINE float
|
||||||
|
HMM_ExpF(float Float)
|
||||||
|
{
|
||||||
|
float Result = 0;
|
||||||
|
|
||||||
|
Result = HMM_EXPF(Float);
|
||||||
|
return (Result);
|
||||||
|
}
|
||||||
|
|
||||||
|
HINLINE float
|
||||||
|
HMM_LogF(float Float)
|
||||||
|
{
|
||||||
|
float Result = 0;
|
||||||
|
|
||||||
|
Result = HMM_LOGF(Float);
|
||||||
|
return (Result);
|
||||||
|
}
|
||||||
|
|
||||||
HINLINE float
|
HINLINE float
|
||||||
HMM_SquareRootF(float Value)
|
HMM_SquareRootF(float Value)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user