1 /* HOST_WIDE_INT definitions for the GNU compiler.
2 Copyright (C) 1998, 2001 Free Software Foundation, Inc.
4 This file is part of GNU CC.
6 Provide definitions for macros which depend on HOST_BITS_PER_INT
7 and HOST_BITS_PER_LONG. */
12 /* Only do all of this if both of these macros are defined, otherwise
13 they'll evaluate to zero, which is not what you want. */
14 #if defined (HOST_BITS_PER_LONG) && defined (HOST_BITS_PER_INT)
16 /* Find the largest host integer type and set its size and type. */
18 /* Use long long on the host if the target has a wider long type than
21 #if ! defined HOST_BITS_PER_WIDE_INT \
22 && defined HOST_BITS_PER_LONGLONG \
23 && (HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG) \
24 && (defined (LONG_LONG_MAX) || defined (LONGLONG_MAX) \
25 || defined (LLONG_MAX) || defined (__GNUC__))
27 # ifdef MAX_LONG_TYPE_SIZE
28 # if MAX_LONG_TYPE_SIZE > HOST_BITS_PER_LONG
29 # define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
30 # define HOST_WIDE_INT long long
33 # if LONG_TYPE_SIZE > HOST_BITS_PER_LONG
34 # define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONGLONG
35 # define HOST_WIDE_INT long long
41 #ifndef HOST_BITS_PER_WIDE_INT
43 # if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
44 # define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
45 # define HOST_WIDE_INT long
47 # define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
48 # define HOST_WIDE_INT int
51 #endif /* ! HOST_BITS_PER_WIDE_INT */
54 /* Provide defaults for the way to print a HOST_WIDE_INT
55 in various manners. */
57 #ifndef HOST_WIDE_INT_PRINT_DEC
58 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
59 # define HOST_WIDE_INT_PRINT_DEC "%d"
61 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
62 # define HOST_WIDE_INT_PRINT_DEC "%ld"
64 # define HOST_WIDE_INT_PRINT_DEC "%lld"
67 #endif /* ! HOST_WIDE_INT_PRINT_DEC */
69 #ifndef HOST_WIDE_INT_PRINT_UNSIGNED
70 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
71 # define HOST_WIDE_INT_PRINT_UNSIGNED "%u"
73 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
74 # define HOST_WIDE_INT_PRINT_UNSIGNED "%lu"
76 # define HOST_WIDE_INT_PRINT_UNSIGNED "%llu"
79 #endif /* ! HOST_WIDE_INT_PRINT_UNSIGNED */
81 #ifndef HOST_WIDE_INT_PRINT_HEX
82 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
83 # define HOST_WIDE_INT_PRINT_HEX "0x%x"
85 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
86 # define HOST_WIDE_INT_PRINT_HEX "0x%lx"
88 # define HOST_WIDE_INT_PRINT_HEX "0x%llx"
91 #endif /* ! HOST_WIDE_INT_PRINT_HEX */
93 #ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX
94 # if HOST_BITS_PER_WIDE_INT == 64
95 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
96 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x"
98 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
99 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
101 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
105 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
106 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x"
108 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
109 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
111 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx"
115 #endif /* ! HOST_WIDE_INT_PRINT_DOUBLE_HEX */
117 #endif /* HOST_BITS_PER_LONG && HOST_BITS_PER_INT */
119 #endif /* __HWINT_H__ */