44 #define cmmax(a,b) ((a)>(b)?(a):(b))
45 #define cmmin(a,b) ((a)<(b)?(a):(b))
46 #define cmabs(a) ((a)<0.0f?(-(a)):(a))
47 #define cmbound(v, vmin, vmax) ((v)>(vmax)?(vmax):((v)<(vmin)?(vmin):(v)))
48 #define cmsgn(a) ((a)<0.0f?-1.0f:1.0f)
49 #define cmthr(a, t) ((a)<(-t)?-1.0f:((a)>(t)?1.0f:0.0f))
50 #define cmmod(a, m) (((a) % (m) + (m)) % (m))
51 #define cmmodf(a, m) (fmodf((fmodf((a), (m)) + (m)), (m)))
53 #define randf() (((float) rand() / (float) (RAND_MAX >> 1)) - 1.0f)
54 #define d2r (const float) (M_PI / 180.0f)
55 #define r2d (const float) (180.0f / M_PI)
64 void getFileName(
char * name,
const int nameSize,
const char * path);
75 #define _strdup strdup
76 #elif defined(__GNUC__)
78 #define _strdup strdup
79 #if defined(__APPLE__)
80 extern "C" void * _aligned_malloc(
size_t size,
size_t alignment);
82 #ifndef _aligned_malloc
83 #define _aligned_malloc(s, a) aligned_alloc(a, s)
87 #define _aligned_free free
89 #elif defined(_MSC_VER)
92 #define alloca(s) _malloca(s)
98 #if LE_USE_SIMD == 1 && LE_USE_SSE2 == 1
99 void *
operator new(
size_t size) {
100 return _aligned_malloc(size, 16);
102 void *
operator new[](
size_t size) {
103 return _aligned_malloc(size, 16);
105 void operator delete(
void * ptr) {
108 void operator delete[](
void * ptr) {
117 extern "C" int __builtin_ffs(
int x);
119 #elif defined (__WATCOMC__)
120 extern "C" int __builtin_ffs(
int x);
125 extern "C" float copysignf(
float x,
float y);
127 #define sinf(n) ((float)std::sin(n))
128 #define asinf(n) ((float)std::asin(n))
129 #define cosf(n) ((float)std::cos(n))
130 #define acosf(n) ((float)std::acos(n))
131 #define tanf(n) ((float)std::tan(n))
132 #define atanf(n) ((float)std::atan(n))
133 #define floorf(n) ((float)std::floor(n))
134 #define ceilf(n) ((float)std::ceil(n))
135 #define sqrtf(n) ((float)std::sqrt(n))
136 #define fabsf(n) ((float)std::fabs(n))
137 #define atan2f(n,m) ((float)std::atan2(n,m))
139 #define M_PI 3.14159265358979323846
141 #elif defined (AMIGA)
142 extern "C" float copysignf(
float x,
float y);
147 #define FROM_LEU16(x) (x = ((uint8_t *) &(x))[0] + (((uint8_t *) &(x))[1] << 8))
148 #define FROM_LES16(x) FROM_LEU16(x)
149 #define FROM_LEU32(x) (x = ((uint8_t *) &x)[0] + (((uint8_t *) &x)[1] << 8) + (((uint8_t *) &x)[2] << 16) + (((uint8_t *) &x)[3] << 24))
150 #define FROM_LES32(x) FROM_LEU32(x)
152 #define TO_LEU16(x) (\
153 ((uint8_t *) &(x))[0] = ((uint16_t) (x)) & 0xFF, \
154 ((uint8_t *) &(x))[1] = ((uint16_t) (x)) >> 8 \
157 #define TO_LES16(x) (\
158 ((uint8_t *) &(x))[0] = ((int16_t) (x)) & 0xFF, \
159 ((uint8_t *) &(x))[1] = ((int16_t) (x)) >> 8 \
162 #define TO_LEU32(x) (\
163 ((uint8_t *) &(x))[0] = ((uint32_t) (x)) & 0xFF, \
164 ((uint8_t *) &(x))[1] = ((uint32_t) (x)) >> 8, \
165 ((uint8_t *) &(x))[2] = ((uint32_t) (x)) >> 16, \
166 ((uint8_t *) &(x))[3] = ((uint32_t) (x)) >> 24 \
169 #define TO_LES32(x) (\
170 ((uint8_t *) &(x))[0] = ((int32_t) (x)) & 0xFF, \
171 ((uint8_t *) &(x))[1] = ((int32_t) (x)) >> 8, \
172 ((uint8_t *) &(x))[2] = ((int32_t) (x)) >> 16, \
173 ((uint8_t *) &(x))[3] = ((int32_t) (x)) >> 24 \
175 #endif // LE_GLOBAL_H
int log2i32(int n)
Definition: global.cpp:106
void toUpper(char *txt)
Definition: global.cpp:50
void toLower(char *txt)
Definition: global.cpp:40
void getFileExtention(char *ext, const int extSize, const char *path)
Definition: global.cpp:61
unsigned long long LeHandle
Definition: global.h:41
void getFileDirectory(char *dir, int dirSize, const char *path)
Definition: global.cpp:90
void getFileName(char *name, const int nameSize, const char *path)
Definition: global.cpp:75