summaryrefslogtreecommitdiff
path: root/inttypes
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-06-02 02:26:21 +0000
committerH. Peter Anvin <hpa@zytor.com>2007-06-02 02:26:21 +0000
commitca9f626ba8976a5b9cdaabaca986448e02e4fdcb (patch)
treeb1f89ee279b2e6d04852b529f4e8e73e731c5849 /inttypes
parentf209f7b1e871c2aa4ae812122c2aec0ec0490538 (diff)
downloadnasm-ca9f626ba8976a5b9cdaabaca986448e02e4fdcb.tar.gz
Fix the [U]INT*_C() creation macros
The [U]INT*_C() macros were broken, because ## takes precedence over macro resolution.
Diffstat (limited to 'inttypes')
-rw-r--r--inttypes/i16l32/inttypes.h26
-rw-r--r--inttypes/i32l32/inttypes.h23
-rw-r--r--inttypes/i32l64/inttypes.h23
3 files changed, 31 insertions, 41 deletions
diff --git a/inttypes/i16l32/inttypes.h b/inttypes/i16l32/inttypes.h
index 6242e192..c0151e8c 100644
--- a/inttypes/i16l32/inttypes.h
+++ b/inttypes/i16l32/inttypes.h
@@ -28,22 +28,22 @@ typedef unsigned long long uint64_t;
#define _pri32 "l"
#define _pri64 "ll"
-#define _c8 ""
-#define _c16 ""
-#define _c32 "L"
-#define _c64 "LL"
+#define _cst8
+#define _cst16
+#define _cst32 L
+#define _cst64 LL
-/* The rest of this is common to all models */
+#define INT8_C(x) x
+#define INT16_C(x) x
+#define INT32_C(x) x ## L
+#define INT64_C(x) x ## LL
-#define INT8_C(x) x ## _c8
-#define INT16_C(x) x ## _c16
-#define INT32_C(x) x ## _c32
-#define INT64_C(x) x ## _c64
+#define UINT8_C(x) x ## U
+#define UINT16_C(x) x ## U
+#define UINT32_C(x) x ## UL
+#define UINT64_C(x) x ## ULL
-#define UINT8_C(x) x ## U ## _c8
-#define UINT16_C(x) x ## U ## _c16
-#define UINT32_C(x) x ## U ## _c32
-#define UINT64_C(x) x ## U ## _c64
+/* The rest of this is common to all models */
#define PRId8 _pri8 "d"
#define PRId16 _pri16 "d"
diff --git a/inttypes/i32l32/inttypes.h b/inttypes/i32l32/inttypes.h
index 2e5760e8..034f0856 100644
--- a/inttypes/i32l32/inttypes.h
+++ b/inttypes/i32l32/inttypes.h
@@ -28,22 +28,17 @@ typedef unsigned long long uint64_t;
#define _pri32 ""
#define _pri64 "ll"
-#define _c8 ""
-#define _c16 ""
-#define _c32 ""
-#define _c64 "LL"
+#define INT8_C(x) x
+#define INT16_C(x) x
+#define INT32_C(x) x
+#define INT64_C(x) x ## LL
-/* The rest of this is common to all models */
-
-#define INT8_C(x) x ## _c8
-#define INT16_C(x) x ## _c16
-#define INT32_C(x) x ## _c32
-#define INT64_C(x) x ## _c64
+#define UINT8_C(x) x ## U
+#define UINT16_C(x) x ## U
+#define UINT32_C(x) x ## U
+#define UINT64_C(x) x ## ULL
-#define UINT8_C(x) x ## U ## _c8
-#define UINT16_C(x) x ## U ## _c16
-#define UINT32_C(x) x ## U ## _c32
-#define UINT64_C(x) x ## U ## _c64
+/* The rest of this is common to all models */
#define PRId8 _pri8 "d"
#define PRId16 _pri16 "d"
diff --git a/inttypes/i32l64/inttypes.h b/inttypes/i32l64/inttypes.h
index 1a4cbb79..a0531c05 100644
--- a/inttypes/i32l64/inttypes.h
+++ b/inttypes/i32l64/inttypes.h
@@ -28,22 +28,17 @@ typedef unsigned long uint64_t;
#define _pri32 ""
#define _pri64 "l"
-#define _c8 ""
-#define _c16 ""
-#define _c32 ""
-#define _c64 "L"
+#define INT8_C(x) x
+#define INT16_C(x) x
+#define INT32_C(x) x
+#define INT64_C(x) x ## L
-/* The rest of this is common to all models */
-
-#define INT8_C(x) x ## _c8
-#define INT16_C(x) x ## _c16
-#define INT32_C(x) x ## _c32
-#define INT64_C(x) x ## _c64
+#define UINT8_C(x) x ## U
+#define UINT16_C(x) x ## U
+#define UINT32_C(x) x ## U
+#define UINT64_C(x) x ## UL
-#define UINT8_C(x) x ## U ## _c8
-#define UINT16_C(x) x ## U ## _c16
-#define UINT32_C(x) x ## U ## _c32
-#define UINT64_C(x) x ## U ## _c64
+/* The rest of this is common to all models */
#define PRId8 _pri8 "d"
#define PRId16 _pri16 "d"