hwint.h revision 52284
152284Sobrien/* HOST_WIDE_INT definitions for the GNU compiler. 252284Sobrien Copyright (C) 1998 Free Software Foundation, Inc. 352284Sobrien 452284Sobrien This file is part of GNU CC. 552284Sobrien 652284Sobrien Provide definitions for macros which depend on HOST_BITS_PER_INT 752284Sobrien and HOST_BITS_PER_LONG. */ 852284Sobrien 952284Sobrien#ifndef __HWINT_H__ 1052284Sobrien#define __HWINT_H__ 1152284Sobrien 1252284Sobrien/* Only do all of this if both of these macros are defined, otherwise 1352284Sobrien they'll evaluate to zero, which is not what you want. */ 1452284Sobrien#if defined (HOST_BITS_PER_LONG) && defined (HOST_BITS_PER_INT) 1552284Sobrien 1652284Sobrien/* Find the largest host integer type and set its size and type. */ 1752284Sobrien 1852284Sobrien#ifndef HOST_BITS_PER_WIDE_INT 1952284Sobrien 2052284Sobrien# if HOST_BITS_PER_LONG > HOST_BITS_PER_INT 2152284Sobrien# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG 2252284Sobrien# define HOST_WIDE_INT long 2352284Sobrien# else 2452284Sobrien# define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT 2552284Sobrien# define HOST_WIDE_INT int 2652284Sobrien# endif 2752284Sobrien 2852284Sobrien#endif /* ! HOST_BITS_PER_WIDE_INT */ 2952284Sobrien 3052284Sobrien 3152284Sobrien/* Provide defaults for the way to print a HOST_WIDE_INT 3252284Sobrien in various manners. */ 3352284Sobrien 3452284Sobrien#ifndef HOST_WIDE_INT_PRINT_DEC 3552284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT 3652284Sobrien# define HOST_WIDE_INT_PRINT_DEC "%d" 3752284Sobrien# else 3852284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG 3952284Sobrien# define HOST_WIDE_INT_PRINT_DEC "%ld" 4052284Sobrien# else 4152284Sobrien# define HOST_WIDE_INT_PRINT_DEC "%lld" 4252284Sobrien# endif 4352284Sobrien# endif 4452284Sobrien#endif /* ! HOST_WIDE_INT_PRINT_DEC */ 4552284Sobrien 4652284Sobrien#ifndef HOST_WIDE_INT_PRINT_UNSIGNED 4752284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT 4852284Sobrien# define HOST_WIDE_INT_PRINT_UNSIGNED "%u" 4952284Sobrien# else 5052284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG 5152284Sobrien# define HOST_WIDE_INT_PRINT_UNSIGNED "%lu" 5252284Sobrien# else 5352284Sobrien# define HOST_WIDE_INT_PRINT_UNSIGNED "%llu" 5452284Sobrien# endif 5552284Sobrien# endif 5652284Sobrien#endif /* ! HOST_WIDE_INT_PRINT_UNSIGNED */ 5752284Sobrien 5852284Sobrien#ifndef HOST_WIDE_INT_PRINT_HEX 5952284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT 6052284Sobrien# define HOST_WIDE_INT_PRINT_HEX "0x%x" 6152284Sobrien# else 6252284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG 6352284Sobrien# define HOST_WIDE_INT_PRINT_HEX "0x%lx" 6452284Sobrien# else 6552284Sobrien# define HOST_WIDE_INT_PRINT_HEX "0x%llx" 6652284Sobrien# endif 6752284Sobrien# endif 6852284Sobrien#endif /* ! HOST_WIDE_INT_PRINT_HEX */ 6952284Sobrien 7052284Sobrien#ifndef HOST_WIDE_INT_PRINT_DOUBLE_HEX 7152284Sobrien# if HOST_BITS_PER_WIDE_INT == 64 7252284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT 7352284Sobrien# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%016x" 7452284Sobrien# else 7552284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG 7652284Sobrien# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%016lx" 7752284Sobrien# else 7852284Sobrien# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx" 7952284Sobrien# endif 8052284Sobrien# endif 8152284Sobrien# else 8252284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_INT 8352284Sobrien# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%x%08x" 8452284Sobrien# else 8552284Sobrien# if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG 8652284Sobrien# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx" 8752284Sobrien# else 8852284Sobrien# define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%08llx" 8952284Sobrien# endif 9052284Sobrien# endif 9152284Sobrien# endif 9252284Sobrien#endif /* ! HOST_WIDE_INT_PRINT_DOUBLE_HEX */ 9352284Sobrien 9452284Sobrien#endif /* HOST_BITS_PER_LONG && HOST_BITS_PER_INT */ 9552284Sobrien 9652284Sobrien#endif /* __HWINT_H__ */ 97