[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1209078352-7593-45-git-send-email-hpa@zytor.com>
Date: Thu, 24 Apr 2008 16:05:51 -0700
From: "H. Peter Anvin" <hpa@...or.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Arch Mailing List <linux-arch@...r.kernel.org>,
"H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH 23/24] types: add C99-style constructors to <asm-generic/int-*.h>
Add C99-style constructor macros for fixed types to
<asm-generic/int-*.h>. Since Linux uses names like "u64" instead of
"uint64_t", the constructor macros are called U64_C() instead of
UINT64_C() and so forth.
These macros allow specific sizes to be specified as
U64_C(0x123456789abcdef), without gcc issuing warnings as it will if
one writes (u64)0x123456789abcdef.
When used from assembly, these macros pass their argument unchanged.
Signed-off-by: H. Peter Anvin <hpa@...or.com>
---
include/asm-generic/int-l64.h | 20 ++++++++++++++++++++
include/asm-generic/int-ll64.h | 20 ++++++++++++++++++++
2 files changed, 40 insertions(+), 0 deletions(-)
diff --git a/include/asm-generic/int-l64.h b/include/asm-generic/int-l64.h
index 629b5a4..2af9b75 100644
--- a/include/asm-generic/int-l64.h
+++ b/include/asm-generic/int-l64.h
@@ -44,6 +44,26 @@ typedef unsigned int u32;
typedef signed long s64;
typedef unsigned long u64;
+#define S8_C(x) x
+#define U8_C(x) x ## U
+#define S16_C(x) x
+#define U16_C(x) x ## U
+#define S32_C(x) x
+#define U32_C(x) x ## U
+#define S64_C(x) x ## L
+#define U64_C(x) x ## UL
+
+#else /* __ASSEMBLY__ */
+
+#define S8_C(x) x
+#define U8_C(x) x
+#define S16_C(x) x
+#define U16_C(x) x
+#define S32_C(x) x
+#define U32_C(x) x
+#define S64_C(x) x
+#define U64_C(x) x
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h
index 1e5ffec..2609489 100644
--- a/include/asm-generic/int-ll64.h
+++ b/include/asm-generic/int-ll64.h
@@ -49,6 +49,26 @@ typedef unsigned int u32;
typedef signed long long s64;
typedef unsigned long long u64;
+#define S8_C(x) x
+#define U8_C(x) x ## U
+#define S16_C(x) x
+#define U16_C(x) x ## U
+#define S32_C(x) x
+#define U32_C(x) x ## U
+#define S64_C(x) x ## LL
+#define U64_C(x) x ## ULL
+
+#else /* __ASSEMBLY__ */
+
+#define S8_C(x) x
+#define U8_C(x) x
+#define S16_C(x) x
+#define U16_C(x) x
+#define S32_C(x) x
+#define U32_C(x) x
+#define S64_C(x) x
+#define U64_C(x) x
+
#endif /* __ASSEMBLY__ */
#endif /* __KERNEL__ */
--
1.5.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists