Skip to content

Commit

Permalink
Don't directly declare standard function names
Browse files Browse the repository at this point in the history
  • Loading branch information
kcat committed Nov 7, 2018
1 parent d76e980 commit 27fbccf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions common/math_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@ static const union msvc_inf_hack {
#endif

#ifndef HAVE_LOG2F
static inline float log2f(float f)
static inline float my_log2f(float f)
{
return logf(f) / logf(2.0f);
}
#define log2f my_log2f
#endif

#ifndef HAVE_CBRTF
static inline float cbrtf(float f)
static inline float my_cbrtf(float f)
{
return powf(f, 1.0f/3.0f);
}
#define cbrtf my_cbrtf
#endif

#ifndef HAVE_COPYSIGNF
static inline float copysignf(float x, float y)
static inline float my_copysignf(float x, float y)
{
union {
float f;
Expand All @@ -57,6 +59,7 @@ static inline float copysignf(float x, float y)
ux.u |= (uy.u&0x80000000u);
return ux.f;
}
#define copysignf my_copysignf
#endif

#define DEG2RAD(x) ((float)(x) * (float)(M_PI/180.0))
Expand Down

0 comments on commit 27fbccf

Please sign in to comment.