From b55fb4f2f6952f08ede8b37ba15ec8639410cca4 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Fri, 18 Jan 2013 14:12:19 -0500 Subject: Last set of minor cleanups --- src/porting.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/porting.h') 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 struct alignment_trick { char c; T member; }; +//#define ALIGNOF(type) offsetof (alignment_trick, member) + #ifdef _WIN32 #include + + #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 + + #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 { -- cgit v1.2.3