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 bluegr committed Nov 5, 2017
1 parent 39ad93d commit 6af0c77b5a8fb9176870b287e0eb18c99c82c102
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 6af0c77

Please sign in to comment.