text: #ifndef __P2DEFS_H__
  #define __P2DEFS_H__
  
  #include <stdio.h>
  
  //  NULL just in case ----------------------
  
  #ifdef NULL
  #undef NULL
  #endif
  #define NULL  0
  
  #define DEGTORAD 0.0174532925
  
  // Deletes a buffer
  #define RELEASE( x ) \
      {                        \
      if( x != NULL )        \
  	    {                      \
        delete x;            \
  	  x = NULL;              \
  	    }                      \
      }
  
  // Deletes an array of buffers
  #define RELEASE_ARRAY( x ) \
      {                              \
      if( x != NULL )              \
  	    {                            \
        delete[] x;                \
  	  x = NULL;                    \
  	    }                            \
                                \
      }
  
  #define IN_RANGE( value, min, max ) ( ((value) >= (min) && (value) <= (max)) ? 1 : 0 )
  #define MIN( a, b ) ( ((a) < (b)) ? (a) : (b) )
  #define MAX( a, b ) ( ((a) > (b)) ? (a) : (b) )
  #define TO_BOOL( a )  ( (a != 0) ? true : false )
  #define CLAMP(x, upper, lower) (MIN(upper, MAX(x, lower)))
  
  typedef unsigned int uint;
  typedef unsigned __int32 uint32;
  typedef unsigned __int64 uint64;
  typedef unsigned char uchar;
  
  template <class VALUE_TYPE> void SWAP(VALUE_TYPE& a, VALUE_TYPE& b)
  {
  	VALUE_TYPE tmp = a;
  	a = b;
  	b = tmp;
  }
  
  // Standard string size
  #define SHORT_STR	32
  #define MID_STR		255
  #define HUGE_STR	8192
  
  // Joins a path and file
  inline const char* const PATH(const char* folder, const char* file)
  {
  	static char path[MID_STR];
  	sprintf_s(path, MID_STR, "%s/%s", folder, file);
  	return path;
  }
  
  // Performance macros
  #define PERF_START(timer) timer.Start()
  #define PERF_PEEK(timer) LOG("%s took %f ms", __FUNCTION__, timer.ReadMs())
  
  #endif