1 /* HOST_WIDE_INT definitions for the GNU compiler.
2 Copyright (C) 1998 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 #ifndef HOST_BITS_PER_WIDE_INT
20 # if HOST_BITS_PER_LONG > HOST_BITS_PER_INT
21 # define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG
22 # define HOST_WIDE_INT long
24 # define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
25 # define HOST_WIDE_INT int
28 #endif /* ! HOST_BITS_PER_WIDE_INT */
31 /* Provide defaults for the way to print a HOST_WIDE_INT
32 in various manners. */
34 #ifndef HOST_WIDE_INT_PRINT_DEC
35 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
36 # define HOST_WIDE_INT_PRINT_DEC "%d"
38 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
39 # define HOST_WIDE_INT_PRINT_DEC "%ld"
41 # define HOST_WIDE_INT_PRINT_DEC "%lld"
44 #endif /* ! HOST_WIDE_INT_PRINT_DEC */
46 #ifndef HOST_WIDE_INT_PRINT_UNSIGNED
47 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
48 # define HOST_WIDE_INT_PRINT_UNSIGNED "%u"
50 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
51 # define HOST_WIDE_INT_PRINT_UNSIGNED "%lu"
53 # define HOST_WIDE_INT_PRINT_UNSIGNED "%llu"
56 #endif /* ! HOST_WIDE_INT_PRINT_UNSIGNED */
58 #ifndef HOST_WIDE_INT_PRINT_HEX
59 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
60 # define HOST_WIDE_INT_PRINT_HEX "0x%x"
62 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
63 # define HOST_WIDE_INT_PRINT_HEX "0x%lx"
65 # define HOST_WIDE_INT_PRINT_HEX "0x%llx"
68 #endif /* ! HOST_WIDE_INT_PRINT_HEX */
70 #ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX
71 # if HOST_BITS_PER_WIDE_INT == 64
72 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
73 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x"
75 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
76 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
78 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
82 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
83 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x"
85 # if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
86 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
88 # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx"
92 #endif /* ! HOST_WIDE_INT_PRINT_DOUBLE_HEX */
94 #endif /* HOST_BITS_PER_LONG && HOST_BITS_PER_INT */
96 #endif /* __HWINT_H__ */