X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fporting.h;h=c8d19154c9c341fde8b708d4939e7c8e71f82233;hb=8e5b33d3590719ff2cf1138f563e928d05754d7a;hp=b9534a9c127524192874c8f8126f92c071533dd8;hpb=037b2591971d752e67fa7d47095b996b3f56da5a;p=oweals%2Fminetest.git diff --git a/src/porting.h b/src/porting.h index b9534a9c1..c8d19154c 100644 --- a/src/porting.h +++ b/src/porting.h @@ -25,8 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #define PORTING_HEADER #include -// Included for u32 and such -#include "common_irrlicht.h" +#include "irrlichttypes.h" // u32 #include "debug.h" #include "constants.h" @@ -36,14 +35,37 @@ with this program; if not, write to the Free Software Foundation, Inc., #define SWPRINTF_CHARSTRING L"%s" #endif +//currently not needed +//template struct alignment_trick { char c; T member; }; +//#define ALIGNOF(type) offsetof (alignment_trick, member) + #ifdef _WIN32 #include + #define sleep_ms(x) Sleep(x) #else #include + #include //for uintptr_t + #define sleep_ms(x) usleep(x*1000) #endif +#ifdef _MSC_VER + #define ALIGNOF(x) __alignof(x) + #define strtok_r(x, y, z) strtok_s(x, y, z) + #define strtof(x, y) (float)strtod(x, y) + #define strtoll(x, y, z) _strtoi64(x, y, z) + #define strtoull(x, y, z) _strtoui64(x, y, z) +#else + #define ALIGNOF(x) __alignof__(x) +#endif + +#ifdef __MINGW32__ + #define strtok_r(x, y, z) mystrtok_r(x, y, z) +#endif + +#define PADDING(x, y) ((ALIGNOF(y) - ((uintptr_t)(x) & (ALIGNOF(y) - 1))) & (ALIGNOF(y) - 1)) + namespace porting {