summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'base/stdint_.h')
-rw-r--r--base/stdint_.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/base/stdint_.h b/base/stdint_.h
index 39ab5ac4..537824bd 100644
--- a/base/stdint_.h
+++ b/base/stdint_.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2019 Artifex Software, Inc.
+/* Copyright (C) 2001-2020 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -173,6 +173,10 @@ typedef unsigned long long uint64_t;
# define PRIu32 "u"
# endif
+# ifndef PRIx32
+# define PRIx32 "x"
+# endif
+
# ifndef PRIu64
# define PRIu64 "llu"
# endif
@@ -232,4 +236,16 @@ typedef unsigned long long uint64_t;
# endif
# endif
+/* Pointers are hard to do in pure PRIxPTR style, as some platforms
+ * add 0x before the pointer, and others don't. To be consistent, we
+ * therefore roll our own. The difference here is that we always
+ * include the 0x and the % ourselves, and require the arg to be
+ * cast to an intptr_t.
+*/
+# if ARCH_SIZEOF_SIZE_T == 4
+# define PRI_INTPTR "0x%" PRIx32
+# else
+# define PRI_INTPTR "0x%" PRIx64
+# endif
+
#endif /* stdint__INCLUDED */