summaryrefslogtreecommitdiff
path: root/src/porting.h
diff options
context:
space:
mode:
authorkwolekr <mirrorisim@gmail.com>2013-01-18 14:12:19 -0500
committerPerttu Ahola <celeron55@gmail.com>2013-01-21 21:41:37 +0200
commitb55fb4f2f6952f08ede8b37ba15ec8639410cca4 (patch)
treebf3d12c17f0f3f430ebae73ef61721bb300630da /src/porting.h
parent1cd8351054c6f0b120e603e0e25b85da385f185a (diff)
downloadminetest-b55fb4f2f6952f08ede8b37ba15ec8639410cca4.tar.gz
minetest-b55fb4f2f6952f08ede8b37ba15ec8639410cca4.tar.bz2
minetest-b55fb4f2f6952f08ede8b37ba15ec8639410cca4.zip
Last set of minor cleanups
Diffstat (limited to 'src/porting.h')
-rw-r--r--src/porting.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/porting.h b/src/porting.h
index 2f9d43aca..0062c11f3 100644
--- a/src/porting.h
+++ b/src/porting.h
@@ -35,14 +35,28 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define SWPRINTF_CHARSTRING L"%s"
#endif
+//currently not needed
+//template<typename T> struct alignment_trick { char c; T member; };
+//#define ALIGNOF(type) offsetof (alignment_trick<type>, member)
+
#ifdef _WIN32
#include <windows.h>
+
+ #define ALIGNOF(x) __alignof(x)
#define sleep_ms(x) Sleep(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
#include <unistd.h>
+
+ #define ALIGNOF(x) __alignof__(x)
#define sleep_ms(x) usleep(x*1000)
#endif
+#define PADDING(x, y) ((ALIGNOF(y) - ((uintptr_t)(x) & (ALIGNOF(y) - 1))) & (ALIGNOF(y) - 1))
+
namespace porting
{