aboutsummaryrefslogtreecommitdiff
path: root/src/util.h
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2012-09-09 15:04:25 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2012-09-10 04:25:26 +0200
commit3b3d9996181d9c93c81667f610e31212997fd184 (patch)
treea48dc1f978db90e0ec6cedcbb49420553f3fc7c5 /src/util.h
parentac4e7f6269429b27f32d290df7e0572814e60068 (diff)
Add format characters for (s)size_t and ptrdiff_t
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
index 4b0814c6d3..eb8f781c2c 100644
--- a/src/util.h
+++ b/src/util.h
@@ -54,6 +54,17 @@ static const int64 CENT = 1000000;
#endif
#endif
+/* Format characters for (s)size_t and ptrdiff_t */
+#if defined(_MSC_VER) || defined(__MSVCRT__)
+ #define PRIszx "%Ix"
+ #define PRIszu "%Iu"
+ #define PRIszd "%Id"
+#else
+ #define PRIszx "%zx"
+ #define PRIszu "%zu"
+ #define PRIszd "%zd"
+#endif
+
// This is needed because the foreach macro can't get over the comma in pair<t1, t2>
#define PAIRTYPE(t1, t2) std::pair<t1, t2>