fork download
  1. //currently not needed
  2. //template<typename T> struct alignment_trick { char c; T member; };
  3. //#define ALIGNOF(type) offsetof (alignment_trick<type>, member)
  4.  
  5. #ifdef _WIN32
  6. #include <windows.h>
  7. #define sleep_ms(x) Sleep(x)
  8. #else
  9. #include <unistd.h>
  10. #include <stdint.h> //for uintptr_t
  11.  
  12. #define sleep_ms(x) usleep(x*1000)
  13. #endif
  14.  
  15. #ifdef _MSC_VER
  16. #define ALIGNOF(x) __alignof(x)
  17. #define strtok_r(x, y, z) strtok_s(x, y, z)
  18. #define strtof(x, y) (float)strtod(x, y)
  19. #define strtoll(x, y, z) _strtoi64(x, y, z)
  20. #define strtoull(x, y, z) _strtoui64(x, y, z)
  21. #else
  22. #define ALIGNOF(x) __alignof__(x)
  23. #endif
  24.  
  25. #ifdef __MINGW32__
  26. #define strtok_r(s,d,p) strtok(s,d)
  27. #endif
  28.  
  29. #define PADDING(x, y) ((ALIGNOF(y) - ((uintptr_t)(x) & (ALIGNOF(y) - 1))) & (ALIGNOF(y) - 1))
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty