diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-04-24 16:37:33 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-05-02 19:18:42 -0400 |
commit | c25bd29805f4d854c3a0b4176813f3c1bff569d3 (patch) | |
tree | 8712a2748b842176d177dedb2e6594b71fc2ff10 /include | |
parent | 4cf63c8ac48c63b4c55669d4648506ed2bb8976f (diff) |
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@zytor.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/int-l64.h | 20 | ||||
-rw-r--r-- | 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 629b5a43f0b0..2af9b75d77db 100644 --- a/include/asm-generic/int-l64.h +++ b/include/asm-generic/int-l64.h | |||
@@ -44,6 +44,26 @@ typedef unsigned int u32; | |||
44 | typedef signed long s64; | 44 | typedef signed long s64; |
45 | typedef unsigned long u64; | 45 | typedef unsigned long u64; |
46 | 46 | ||
47 | #define S8_C(x) x | ||
48 | #define U8_C(x) x ## U | ||
49 | #define S16_C(x) x | ||
50 | #define U16_C(x) x ## U | ||
51 | #define S32_C(x) x | ||
52 | #define U32_C(x) x ## U | ||
53 | #define S64_C(x) x ## L | ||
54 | #define U64_C(x) x ## UL | ||
55 | |||
56 | #else /* __ASSEMBLY__ */ | ||
57 | |||
58 | #define S8_C(x) x | ||
59 | #define U8_C(x) x | ||
60 | #define S16_C(x) x | ||
61 | #define U16_C(x) x | ||
62 | #define S32_C(x) x | ||
63 | #define U32_C(x) x | ||
64 | #define S64_C(x) x | ||
65 | #define U64_C(x) x | ||
66 | |||
47 | #endif /* __ASSEMBLY__ */ | 67 | #endif /* __ASSEMBLY__ */ |
48 | 68 | ||
49 | #endif /* __KERNEL__ */ | 69 | #endif /* __KERNEL__ */ |
diff --git a/include/asm-generic/int-ll64.h b/include/asm-generic/int-ll64.h index 1e5ffec05759..260948905e4e 100644 --- a/include/asm-generic/int-ll64.h +++ b/include/asm-generic/int-ll64.h | |||
@@ -49,6 +49,26 @@ typedef unsigned int u32; | |||
49 | typedef signed long long s64; | 49 | typedef signed long long s64; |
50 | typedef unsigned long long u64; | 50 | typedef unsigned long long u64; |
51 | 51 | ||
52 | #define S8_C(x) x | ||
53 | #define U8_C(x) x ## U | ||
54 | #define S16_C(x) x | ||
55 | #define U16_C(x) x ## U | ||
56 | #define S32_C(x) x | ||
57 | #define U32_C(x) x ## U | ||
58 | #define S64_C(x) x ## LL | ||
59 | #define U64_C(x) x ## ULL | ||
60 | |||
61 | #else /* __ASSEMBLY__ */ | ||
62 | |||
63 | #define S8_C(x) x | ||
64 | #define U8_C(x) x | ||
65 | #define S16_C(x) x | ||
66 | #define U16_C(x) x | ||
67 | #define S32_C(x) x | ||
68 | #define U32_C(x) x | ||
69 | #define S64_C(x) x | ||
70 | #define U64_C(x) x | ||
71 | |||
52 | #endif /* __ASSEMBLY__ */ | 72 | #endif /* __ASSEMBLY__ */ |
53 | 73 | ||
54 | #endif /* __KERNEL__ */ | 74 | #endif /* __KERNEL__ */ |