1/* HOST_WIDE_INT definitions for the GNU compiler.
2   Copyright (C) 1998 Free Software Foundation, Inc.
3
4   This file is part of GNU CC.
5
6   Provide definitions for macros which depend on HOST_BITS_PER_INT
7   and HOST_BITS_PER_LONG. */
8
9#ifndef __HWINT_H__
10#define __HWINT_H__
11
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)
15
16/* Find the largest host integer type and set its size and type.  */
17
18#ifndef HOST_BITS_PER_WIDE_INT
19
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
23# else
24#  define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT
25#  define HOST_WIDE_INT int
26# endif
27
28#endif /* ! HOST_BITS_PER_WIDE_INT */
29
30
31/* Provide defaults for the way to print a HOST_WIDE_INT
32   in various manners.  */
33
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"
37# else
38#  if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
39#   define HOST_WIDE_INT_PRINT_DEC "%ld"
40#  else
41#   define HOST_WIDE_INT_PRINT_DEC "%lld"
42#  endif
43# endif
44#endif /* ! HOST_WIDE_INT_PRINT_DEC */
45
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"
49# else
50#  if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
51#   define HOST_WIDE_INT_PRINT_UNSIGNED "%lu"
52#  else
53#   define HOST_WIDE_INT_PRINT_UNSIGNED "%llu"
54#  endif
55# endif
56#endif /* ! HOST_WIDE_INT_PRINT_UNSIGNED */
57
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"
61# else
62#  if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
63#   define HOST_WIDE_INT_PRINT_HEX "0x%lx"
64#  else
65#   define HOST_WIDE_INT_PRINT_HEX "0x%llx"
66#  endif
67# endif
68#endif /* ! HOST_WIDE_INT_PRINT_HEX */
69
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"
74#  else
75#   if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
76#    define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx"
77#   else
78#    define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
79#   endif
80#  endif
81# else
82#  if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT
83#   define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x"
84#  else
85#   if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG
86#    define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
87#   else
88#    define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx"
89#   endif
90#  endif
91# endif
92#endif /* ! HOST_WIDE_INT_PRINT_DOUBLE_HEX */
93
94#endif /* HOST_BITS_PER_LONG && HOST_BITS_PER_INT */
95
96#endif /* __HWINT_H__ */
97