Permalink
Browse files

SWORD25: Remove use of C99 sqrtf

C++ sqrt is overloaded so operates using single-precision when
receiving a float input. The C standard library on FreeMiNT does
not fully support C99 math so use of sqrtf instead of sqrt(float)
does not work.
  • Loading branch information...
csnover authored and ccawley2011 committed Nov 5, 2017
1 parent df236f1 commit 415e9b9bf7004eed86d6e9d26c0a6e90e94a36b9
Showing with 1 addition and 5 deletions.
  1. +1 −5 engines/sword25/math/vertex.h
@@ -45,10 +45,6 @@

struct lua_State;

#if defined(MACOSX) || defined(SOLARIS) || defined(__MINGW32__)
#define sqrtf(x) ((float)sqrt(x))
#endif

namespace Sword25 {

/**
@@ -67,7 +63,7 @@ class Vertex : public Common::Point {
* @remark If only distances should be compared, sqrDist() should be used, since it is faster.
*/
inline int distance(const Vertex &vertex) const {
return (int)(sqrtf(static_cast<float>(sqrDist(vertex))) + 0.5);
return (int)(sqrt(static_cast<float>(sqrDist(vertex))) + 0.5);
}

static Vertex &luaVertexToVertex(lua_State *L, int StackIndex, Vertex &vertex);

0 comments on commit 415e9b9

Please sign in to comment.