Remove makros and add undefs to avoid clashing names

FRAND and Clamp were not used and Clamp collided when doing unit builds.
SQUARE(x) is longer than x*x and if x is an expression it gets evaluated
twice.
This commit is contained in:
Tobias Loose
2013-11-23 16:03:04 +01:00
parent 678a4734bb
commit 352e3c2daa
2 changed files with 12 additions and 10 deletions

View File

@@ -44,6 +44,17 @@ typedef WPARAM LocalKeySym;
#include <X11/keysym.h>
typedef KeySym LocalKeySym;
#define LOCAL_KEY_NONE XK_VoidSymbol
#undef Status
#undef Bool
#undef None
#undef CursorShape
#undef KeyPress
#undef KeyRelease
#undef FocusIn
#undef FocusOut
#undef FontChange
#undef Unsorted
#undef GrayScale
#elif defined(ANDROID) // This is temporary until we understand how to send real key events from Java
typedef long unsigned int LocalKeySym;

View File

@@ -3,15 +3,6 @@
#include <math.h>
/*************************** Macros and constants ***************************/
// returns a number ranging from -1.0 to 1.0
#define FRAND (((float)rand()-(float)rand())/RAND_MAX)
#define Clamp(x, min, max) x = (x<min ? min : x<max ? x : max);
#define SQUARE(x) (x)*(x)
struct Vector3D
{
Vector3D(float x, float y, float z) : x(x), y(y), z(z) {}
@@ -63,7 +54,7 @@ struct Vector3D
float Length()
{
float length = (float)sqrt(SQUARE(x) + SQUARE(y) + SQUARE(z));
float length = sqrt(x*x + y*y + z*z);
return (length != 0.0f) ? length : 1.0f;
}