Artifact
64825aea3484c425b0d9ccc907720d4da67e1a9d:
0000: 23 20 6c 6f 6e 67 6c 6f 6e 67 2e 6d 34 20 73 65 # longlong.m4 se
0010: 72 69 61 6c 20 31 34 0a 64 6e 6c 20 43 6f 70 79 rial 14.dnl Copy
0020: 72 69 67 68 74 20 28 43 29 20 31 39 39 39 2d 32 right (C) 1999-2
0030: 30 30 37 2c 20 32 30 30 39 2d 32 30 31 30 20 46 007, 2009-2010 F
0040: 72 65 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 ree Software Fou
0050: 6e 64 61 74 69 6f 6e 2c 20 49 6e 63 2e 0a 64 6e ndation, Inc..dn
0060: 6c 20 54 68 69 73 20 66 69 6c 65 20 69 73 20 66 l This file is f
0070: 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 74 68 ree software; th
0080: 65 20 46 72 65 65 20 53 6f 66 74 77 61 72 65 20 e Free Software
0090: 46 6f 75 6e 64 61 74 69 6f 6e 0a 64 6e 6c 20 67 Foundation.dnl g
00a0: 69 76 65 73 20 75 6e 6c 69 6d 69 74 65 64 20 70 ives unlimited p
00b0: 65 72 6d 69 73 73 69 6f 6e 20 74 6f 20 63 6f 70 ermission to cop
00c0: 79 20 61 6e 64 2f 6f 72 20 64 69 73 74 72 69 62 y and/or distrib
00d0: 75 74 65 20 69 74 2c 0a 64 6e 6c 20 77 69 74 68 ute it,.dnl with
00e0: 20 6f 72 20 77 69 74 68 6f 75 74 20 6d 6f 64 69 or without modi
00f0: 66 69 63 61 74 69 6f 6e 73 2c 20 61 73 20 6c 6f fications, as lo
0100: 6e 67 20 61 73 20 74 68 69 73 20 6e 6f 74 69 63 ng as this notic
0110: 65 20 69 73 20 70 72 65 73 65 72 76 65 64 2e 0a e is preserved..
0120: 0a 64 6e 6c 20 46 72 6f 6d 20 50 61 75 6c 20 45 .dnl From Paul E
0130: 67 67 65 72 74 2e 0a 0a 23 20 44 65 66 69 6e 65 ggert...# Define
0140: 20 48 41 56 45 5f 4c 4f 4e 47 5f 4c 4f 4e 47 5f HAVE_LONG_LONG_
0150: 49 4e 54 20 69 66 20 27 6c 6f 6e 67 20 6c 6f 6e INT if 'long lon
0160: 67 20 69 6e 74 27 20 77 6f 72 6b 73 2e 0a 23 20 g int' works..#
0170: 54 68 69 73 20 66 69 78 65 73 20 61 20 62 75 67 This fixes a bug
0180: 20 69 6e 20 41 75 74 6f 63 6f 6e 66 20 32 2e 36 in Autoconf 2.6
0190: 31 2c 20 62 75 74 20 63 61 6e 20 62 65 20 72 65 1, but can be re
01a0: 6d 6f 76 65 64 20 6f 6e 63 65 20 77 65 0a 23 20 moved once we.#
01b0: 61 73 73 75 6d 65 20 32 2e 36 32 20 65 76 65 72 assume 2.62 ever
01c0: 79 77 68 65 72 65 2e 0a 0a 23 20 4e 6f 74 65 3a ywhere...# Note:
01d0: 20 49 66 20 74 68 65 20 74 79 70 65 20 27 6c 6f If the type 'lo
01e0: 6e 67 20 6c 6f 6e 67 20 69 6e 74 27 20 65 78 69 ng long int' exi
01f0: 73 74 73 20 62 75 74 20 69 73 20 6f 6e 6c 79 20 sts but is only
0200: 33 32 20 62 69 74 73 20 6c 61 72 67 65 0a 23 20 32 bits large.#
0210: 28 61 73 20 6f 6e 20 73 6f 6d 65 20 76 65 72 79 (as on some very
0220: 20 6f 6c 64 20 63 6f 6d 70 69 6c 65 72 73 29 2c old compilers),
0230: 20 48 41 56 45 5f 4c 4f 4e 47 5f 4c 4f 4e 47 5f HAVE_LONG_LONG_
0240: 49 4e 54 20 77 69 6c 6c 20 6e 6f 74 20 62 65 0a INT will not be.
0250: 23 20 64 65 66 69 6e 65 64 2e 20 49 6e 20 74 68 # defined. In th
0260: 69 73 20 63 61 73 65 20 79 6f 75 20 63 61 6e 20 is case you can
0270: 74 72 65 61 74 20 27 6c 6f 6e 67 20 6c 6f 6e 67 treat 'long long
0280: 20 69 6e 74 27 20 6c 69 6b 65 20 27 6c 6f 6e 67 int' like 'long
0290: 20 69 6e 74 27 2e 0a 0a 41 43 5f 44 45 46 55 4e int'...AC_DEFUN
02a0: 28 5b 41 43 5f 54 59 50 45 5f 4c 4f 4e 47 5f 4c ([AC_TYPE_LONG_L
02b0: 4f 4e 47 5f 49 4e 54 5d 2c 0a 5b 0a 20 20 41 43 ONG_INT],.[. AC
02c0: 5f 43 41 43 48 45 5f 43 48 45 43 4b 28 5b 66 6f _CACHE_CHECK([fo
02d0: 72 20 6c 6f 6e 67 20 6c 6f 6e 67 20 69 6e 74 5d r long long int]
02e0: 2c 20 5b 61 63 5f 63 76 5f 74 79 70 65 5f 6c 6f , [ac_cv_type_lo
02f0: 6e 67 5f 6c 6f 6e 67 5f 69 6e 74 5d 2c 0a 20 20 ng_long_int],.
0300: 20 20 5b 41 43 5f 4c 49 4e 4b 5f 49 46 45 4c 53 [AC_LINK_IFELS
0310: 45 28 0a 20 20 20 20 20 20 20 5b 5f 41 43 5f 54 E(. [_AC_T
0320: 59 50 45 5f 4c 4f 4e 47 5f 4c 4f 4e 47 5f 53 4e YPE_LONG_LONG_SN
0330: 49 50 50 45 54 5d 2c 0a 20 20 20 20 20 20 20 5b IPPET],. [
0340: 64 6e 6c 20 54 68 69 73 20 63 61 74 63 68 65 73 dnl This catches
0350: 20 61 20 62 75 67 20 69 6e 20 54 61 6e 64 65 6d a bug in Tandem
0360: 20 4e 6f 6e 53 74 6f 70 20 4b 65 72 6e 65 6c 20 NonStop Kernel
0370: 28 4f 53 53 29 20 63 63 20 2d 4f 20 63 69 72 63 (OSS) cc -O circ
0380: 61 20 32 30 30 34 2e 0a 20 20 20 20 20 20 20 20 a 2004..
0390: 64 6e 6c 20 49 66 20 63 72 6f 73 73 20 63 6f 6d dnl If cross com
03a0: 70 69 6c 69 6e 67 2c 20 61 73 73 75 6d 65 20 74 piling, assume t
03b0: 68 65 20 62 75 67 20 69 73 6e 27 74 20 69 6d 70 he bug isn't imp
03c0: 6f 72 74 61 6e 74 2c 20 73 69 6e 63 65 0a 20 20 ortant, since.
03d0: 20 20 20 20 20 20 64 6e 6c 20 6e 6f 62 6f 64 79 dnl nobody
03e0: 20 63 72 6f 73 73 20 63 6f 6d 70 69 6c 65 73 20 cross compiles
03f0: 66 6f 72 20 74 68 69 73 20 70 6c 61 74 66 6f 72 for this platfor
0400: 6d 20 61 73 20 66 61 72 20 61 73 20 77 65 20 6b m as far as we k
0410: 6e 6f 77 2e 0a 20 20 20 20 20 20 20 20 41 43 5f now.. AC_
0420: 52 55 4e 5f 49 46 45 4c 53 45 28 0a 20 20 20 20 RUN_IFELSE(.
0430: 20 20 20 20 20 20 5b 41 43 5f 4c 41 4e 47 5f 50 [AC_LANG_P
0440: 52 4f 47 52 41 4d 28 0a 20 20 20 20 20 20 20 20 ROGRAM(.
0450: 20 20 20 20 20 5b 5b 40 25 3a 40 69 6e 63 6c 75 [[@%:@inclu
0460: 64 65 20 3c 6c 69 6d 69 74 73 2e 68 3e 0a 20 20 de <limits.h>.
0470: 20 20 20 20 20 20 20 20 20 20 20 20 20 40 25 3a @%:
0480: 40 69 66 6e 64 65 66 20 4c 4c 4f 4e 47 5f 4d 41 @ifndef LLONG_MA
0490: 58 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 X.
04a0: 20 40 25 3a 40 20 64 65 66 69 6e 65 20 48 41 4c @%:@ define HAL
04b0: 46 20 5c 0a 20 20 20 20 20 20 20 20 20 20 20 20 F \.
04c0: 20 20 20 20 20 20 20 20 20 20 20 20 28 31 4c 4c (1LL
04d0: 20 3c 3c 20 28 73 69 7a 65 6f 66 20 28 6c 6f 6e << (sizeof (lon
04e0: 67 20 6c 6f 6e 67 20 69 6e 74 29 20 2a 20 43 48 g long int) * CH
04f0: 41 52 5f 42 49 54 20 2d 20 32 29 29 0a 20 20 20 AR_BIT - 2)).
0500: 20 20 20 20 20 20 20 20 20 20 20 20 40 25 3a 40 @%:@
0510: 20 64 65 66 69 6e 65 20 4c 4c 4f 4e 47 5f 4d 41 define LLONG_MA
0520: 58 20 28 48 41 4c 46 20 2d 20 31 20 2b 20 48 41 X (HALF - 1 + HA
0530: 4c 46 29 0a 20 20 20 20 20 20 20 20 20 20 20 20 LF).
0540: 20 20 20 40 25 3a 40 65 6e 64 69 66 5d 5d 2c 0a @%:@endif]],.
0550: 20 20 20 20 20 20 20 20 20 20 20 20 20 5b 5b 6c [[l
0560: 6f 6e 67 20 6c 6f 6e 67 20 69 6e 74 20 6e 20 3d ong long int n =
0570: 20 31 3b 0a 20 20 20 20 20 20 20 20 20 20 20 20 1;.
0580: 20 20 20 69 6e 74 20 69 3b 0a 20 20 20 20 20 20 int i;.
0590: 20 20 20 20 20 20 20 20 20 66 6f 72 20 28 69 20 for (i
05a0: 3d 20 30 3b 20 3b 20 69 2b 2b 29 0a 20 20 20 20 = 0; ; i++).
05b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 7b 0a 20 {.
05c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
05d0: 20 20 6c 6f 6e 67 20 6c 6f 6e 67 20 69 6e 74 20 long long int
05e0: 6d 20 3d 20 6e 20 3c 3c 20 69 3b 0a 20 20 20 20 m = n << i;.
05f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 69 i
0600: 66 20 28 6d 20 3e 3e 20 69 20 21 3d 20 6e 29 0a f (m >> i != n).
0610: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0620: 20 20 20 20 20 72 65 74 75 72 6e 20 31 3b 0a 20 return 1;.
0630: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0640: 20 20 69 66 20 28 4c 4c 4f 4e 47 5f 4d 41 58 20 if (LLONG_MAX
0650: 2f 20 32 20 3c 20 6d 29 0a 20 20 20 20 20 20 20 / 2 < m).
0660: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 62 72 br
0670: 65 61 6b 3b 0a 20 20 20 20 20 20 20 20 20 20 20 eak;.
0680: 20 20 20 20 20 20 7d 0a 20 20 20 20 20 20 20 20 }.
0690: 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 30 3b return 0;
06a0: 5d 5d 29 5d 2c 0a 20 20 20 20 20 20 20 20 20 20 ]])],.
06b0: 5b 61 63 5f 63 76 5f 74 79 70 65 5f 6c 6f 6e 67 [ac_cv_type_long
06c0: 5f 6c 6f 6e 67 5f 69 6e 74 3d 79 65 73 5d 2c 0a _long_int=yes],.
06d0: 20 20 20 20 20 20 20 20 20 20 5b 61 63 5f 63 76 [ac_cv
06e0: 5f 74 79 70 65 5f 6c 6f 6e 67 5f 6c 6f 6e 67 5f _type_long_long_
06f0: 69 6e 74 3d 6e 6f 5d 2c 0a 20 20 20 20 20 20 20 int=no],.
0700: 20 20 20 5b 61 63 5f 63 76 5f 74 79 70 65 5f 6c [ac_cv_type_l
0710: 6f 6e 67 5f 6c 6f 6e 67 5f 69 6e 74 3d 79 65 73 ong_long_int=yes
0720: 5d 29 5d 2c 0a 20 20 20 20 20 20 20 5b 61 63 5f ])],. [ac_
0730: 63 76 5f 74 79 70 65 5f 6c 6f 6e 67 5f 6c 6f 6e cv_type_long_lon
0740: 67 5f 69 6e 74 3d 6e 6f 5d 29 5d 29 0a 20 20 69 g_int=no])]). i
0750: 66 20 74 65 73 74 20 24 61 63 5f 63 76 5f 74 79 f test $ac_cv_ty
0760: 70 65 5f 6c 6f 6e 67 5f 6c 6f 6e 67 5f 69 6e 74 pe_long_long_int
0770: 20 3d 20 79 65 73 3b 20 74 68 65 6e 0a 20 20 20 = yes; then.
0780: 20 41 43 5f 44 45 46 49 4e 45 28 5b 48 41 56 45 AC_DEFINE([HAVE
0790: 5f 4c 4f 4e 47 5f 4c 4f 4e 47 5f 49 4e 54 5d 2c _LONG_LONG_INT],
07a0: 20 5b 31 5d 2c 0a 20 20 20 20 20 20 5b 44 65 66 [1],. [Def
07b0: 69 6e 65 20 74 6f 20 31 20 69 66 20 74 68 65 20 ine to 1 if the
07c0: 73 79 73 74 65 6d 20 68 61 73 20 74 68 65 20 74 system has the t
07d0: 79 70 65 20 60 6c 6f 6e 67 20 6c 6f 6e 67 20 69 ype `long long i
07e0: 6e 74 27 2e 5d 29 0a 20 20 66 69 0a 5d 29 0a 0a nt'.]). fi.])..
07f0: 23 20 44 65 66 69 6e 65 20 48 41 56 45 5f 55 4e # Define HAVE_UN
0800: 53 49 47 4e 45 44 5f 4c 4f 4e 47 5f 4c 4f 4e 47 SIGNED_LONG_LONG
0810: 5f 49 4e 54 20 69 66 20 27 75 6e 73 69 67 6e 65 _INT if 'unsigne
0820: 64 20 6c 6f 6e 67 20 6c 6f 6e 67 20 69 6e 74 27 d long long int'
0830: 20 77 6f 72 6b 73 2e 0a 23 20 54 68 69 73 20 66 works..# This f
0840: 69 78 65 73 20 61 20 62 75 67 20 69 6e 20 41 75 ixes a bug in Au
0850: 74 6f 63 6f 6e 66 20 32 2e 36 31 2c 20 62 75 74 toconf 2.61, but
0860: 20 63 61 6e 20 62 65 20 72 65 6d 6f 76 65 64 20 can be removed
0870: 6f 6e 63 65 20 77 65 0a 23 20 61 73 73 75 6d 65 once we.# assume
0880: 20 32 2e 36 32 20 65 76 65 72 79 77 68 65 72 65 2.62 everywhere
0890: 2e 0a 0a 23 20 4e 6f 74 65 3a 20 49 66 20 74 68 ...# Note: If th
08a0: 65 20 74 79 70 65 20 27 75 6e 73 69 67 6e 65 64 e type 'unsigned
08b0: 20 6c 6f 6e 67 20 6c 6f 6e 67 20 69 6e 74 27 20 long long int'
08c0: 65 78 69 73 74 73 20 62 75 74 20 69 73 20 6f 6e exists but is on
08d0: 6c 79 20 33 32 20 62 69 74 73 0a 23 20 6c 61 72 ly 32 bits.# lar
08e0: 67 65 20 28 61 73 20 6f 6e 20 73 6f 6d 65 20 76 ge (as on some v
08f0: 65 72 79 20 6f 6c 64 20 63 6f 6d 70 69 6c 65 72 ery old compiler
0900: 73 29 2c 20 41 43 5f 54 59 50 45 5f 55 4e 53 49 s), AC_TYPE_UNSI
0910: 47 4e 45 44 5f 4c 4f 4e 47 5f 4c 4f 4e 47 5f 49 GNED_LONG_LONG_I
0920: 4e 54 0a 23 20 77 69 6c 6c 20 6e 6f 74 20 62 65 NT.# will not be
0930: 20 64 65 66 69 6e 65 64 2e 20 49 6e 20 74 68 69 defined. In thi
0940: 73 20 63 61 73 65 20 79 6f 75 20 63 61 6e 20 74 s case you can t
0950: 72 65 61 74 20 27 75 6e 73 69 67 6e 65 64 20 6c reat 'unsigned l
0960: 6f 6e 67 20 6c 6f 6e 67 20 69 6e 74 27 0a 23 20 ong long int'.#
0970: 6c 69 6b 65 20 27 75 6e 73 69 67 6e 65 64 20 6c like 'unsigned l
0980: 6f 6e 67 20 69 6e 74 27 2e 0a 0a 41 43 5f 44 45 ong int'...AC_DE
0990: 46 55 4e 28 5b 41 43 5f 54 59 50 45 5f 55 4e 53 FUN([AC_TYPE_UNS
09a0: 49 47 4e 45 44 5f 4c 4f 4e 47 5f 4c 4f 4e 47 5f IGNED_LONG_LONG_
09b0: 49 4e 54 5d 2c 0a 5b 0a 20 20 41 43 5f 43 41 43 INT],.[. AC_CAC
09c0: 48 45 5f 43 48 45 43 4b 28 5b 66 6f 72 20 75 6e HE_CHECK([for un
09d0: 73 69 67 6e 65 64 20 6c 6f 6e 67 20 6c 6f 6e 67 signed long long
09e0: 20 69 6e 74 5d 2c 0a 20 20 20 20 5b 61 63 5f 63 int],. [ac_c
09f0: 76 5f 74 79 70 65 5f 75 6e 73 69 67 6e 65 64 5f v_type_unsigned_
0a00: 6c 6f 6e 67 5f 6c 6f 6e 67 5f 69 6e 74 5d 2c 0a long_long_int],.
0a10: 20 20 20 20 5b 41 43 5f 4c 49 4e 4b 5f 49 46 45 [AC_LINK_IFE
0a20: 4c 53 45 28 0a 20 20 20 20 20 20 20 5b 5f 41 43 LSE(. [_AC
0a30: 5f 54 59 50 45 5f 4c 4f 4e 47 5f 4c 4f 4e 47 5f _TYPE_LONG_LONG_
0a40: 53 4e 49 50 50 45 54 5d 2c 0a 20 20 20 20 20 20 SNIPPET],.
0a50: 20 5b 61 63 5f 63 76 5f 74 79 70 65 5f 75 6e 73 [ac_cv_type_uns
0a60: 69 67 6e 65 64 5f 6c 6f 6e 67 5f 6c 6f 6e 67 5f igned_long_long_
0a70: 69 6e 74 3d 79 65 73 5d 2c 0a 20 20 20 20 20 20 int=yes],.
0a80: 20 5b 61 63 5f 63 76 5f 74 79 70 65 5f 75 6e 73 [ac_cv_type_uns
0a90: 69 67 6e 65 64 5f 6c 6f 6e 67 5f 6c 6f 6e 67 5f igned_long_long_
0aa0: 69 6e 74 3d 6e 6f 5d 29 5d 29 0a 20 20 69 66 20 int=no])]). if
0ab0: 74 65 73 74 20 24 61 63 5f 63 76 5f 74 79 70 65 test $ac_cv_type
0ac0: 5f 75 6e 73 69 67 6e 65 64 5f 6c 6f 6e 67 5f 6c _unsigned_long_l
0ad0: 6f 6e 67 5f 69 6e 74 20 3d 20 79 65 73 3b 20 74 ong_int = yes; t
0ae0: 68 65 6e 0a 20 20 20 20 41 43 5f 44 45 46 49 4e hen. AC_DEFIN
0af0: 45 28 5b 48 41 56 45 5f 55 4e 53 49 47 4e 45 44 E([HAVE_UNSIGNED
0b00: 5f 4c 4f 4e 47 5f 4c 4f 4e 47 5f 49 4e 54 5d 2c _LONG_LONG_INT],
0b10: 20 5b 31 5d 2c 0a 20 20 20 20 20 20 5b 44 65 66 [1],. [Def
0b20: 69 6e 65 20 74 6f 20 31 20 69 66 20 74 68 65 20 ine to 1 if the
0b30: 73 79 73 74 65 6d 20 68 61 73 20 74 68 65 20 74 system has the t
0b40: 79 70 65 20 60 75 6e 73 69 67 6e 65 64 20 6c 6f ype `unsigned lo
0b50: 6e 67 20 6c 6f 6e 67 20 69 6e 74 27 2e 5d 29 0a ng long int'.]).
0b60: 20 20 66 69 0a 5d 29 0a 0a 23 20 45 78 70 61 6e fi.])..# Expan
0b70: 64 73 20 74 6f 20 61 20 43 20 70 72 6f 67 72 61 ds to a C progra
0b80: 6d 20 74 68 61 74 20 63 61 6e 20 62 65 20 75 73 m that can be us
0b90: 65 64 20 74 6f 20 74 65 73 74 20 66 6f 72 20 73 ed to test for s
0ba0: 69 6d 75 6c 74 61 6e 65 6f 75 73 20 73 75 70 70 imultaneous supp
0bb0: 6f 72 74 0a 23 20 6f 66 20 27 6c 6f 6e 67 20 6c ort.# of 'long l
0bc0: 6f 6e 67 27 20 61 6e 64 20 27 75 6e 73 69 67 6e ong' and 'unsign
0bd0: 65 64 20 6c 6f 6e 67 20 6c 6f 6e 67 27 2e 20 57 ed long long'. W
0be0: 65 20 64 6f 6e 27 74 20 77 61 6e 74 20 74 6f 20 e don't want to
0bf0: 73 61 79 20 74 68 61 74 0a 23 20 27 6c 6f 6e 67 say that.# 'long
0c00: 20 6c 6f 6e 67 27 20 69 73 20 61 76 61 69 6c 61 long' is availa
0c10: 62 6c 65 20 69 66 20 27 75 6e 73 69 67 6e 65 64 ble if 'unsigned
0c20: 20 6c 6f 6e 67 20 6c 6f 6e 67 27 20 69 73 20 6e long long' is n
0c30: 6f 74 2c 20 6f 72 20 76 69 63 65 20 76 65 72 73 ot, or vice vers
0c40: 61 2c 0a 23 20 62 65 63 61 75 73 65 20 74 6f 6f a,.# because too
0c50: 20 6d 61 6e 79 20 70 72 6f 67 72 61 6d 73 20 72 many programs r
0c60: 65 6c 79 20 6f 6e 20 74 68 65 20 73 79 6d 6d 65 ely on the symme
0c70: 74 72 79 20 62 65 74 77 65 65 6e 20 73 69 67 6e try between sign
0c80: 65 64 20 61 6e 64 20 75 6e 73 69 67 6e 65 64 0a ed and unsigned.
0c90: 23 20 69 6e 74 65 67 65 72 20 74 79 70 65 73 20 # integer types
0ca0: 28 65 78 63 6c 75 64 69 6e 67 20 27 62 6f 6f 6c (excluding 'bool
0cb0: 27 29 2e 0a 41 43 5f 44 45 46 55 4e 28 5b 5f 41 ')..AC_DEFUN([_A
0cc0: 43 5f 54 59 50 45 5f 4c 4f 4e 47 5f 4c 4f 4e 47 C_TYPE_LONG_LONG
0cd0: 5f 53 4e 49 50 50 45 54 5d 2c 0a 5b 0a 20 20 41 _SNIPPET],.[. A
0ce0: 43 5f 4c 41 4e 47 5f 50 52 4f 47 52 41 4d 28 0a C_LANG_PROGRAM(.
0cf0: 20 20 20 20 5b 5b 2f 2a 20 46 6f 72 20 6e 6f 77 [[/* For now
0d00: 2c 20 64 6f 20 6e 6f 74 20 74 65 73 74 20 74 68 , do not test th
0d10: 65 20 70 72 65 70 72 6f 63 65 73 73 6f 72 3b 20 e preprocessor;
0d20: 61 73 20 6f 66 20 32 30 30 37 20 74 68 65 72 65 as of 2007 there
0d30: 20 61 72 65 20 74 6f 6f 20 6d 61 6e 79 0a 20 20 are too many.
0d40: 20 20 20 20 20 20 20 69 6d 70 6c 65 6d 65 6e 74 implement
0d50: 61 74 69 6f 6e 73 20 77 69 74 68 20 62 72 6f 6b ations with brok
0d60: 65 6e 20 70 72 65 70 72 6f 63 65 73 73 6f 72 73 en preprocessors
0d70: 2e 20 20 50 65 72 68 61 70 73 20 74 68 69 73 20 . Perhaps this
0d80: 63 61 6e 0a 20 20 20 20 20 20 20 20 20 62 65 20 can. be
0d90: 72 65 76 69 73 69 74 65 64 20 69 6e 20 32 30 31 revisited in 201
0da0: 32 2e 20 20 49 6e 20 74 68 65 20 6d 65 61 6e 74 2. In the meant
0db0: 69 6d 65 2c 20 63 6f 64 65 20 73 68 6f 75 6c 64 ime, code should
0dc0: 20 6e 6f 74 20 65 78 70 65 63 74 0a 20 20 20 20 not expect.
0dd0: 20 20 20 20 20 23 69 66 20 74 6f 20 77 6f 72 6b #if to work
0de0: 20 77 69 74 68 20 6c 69 74 65 72 61 6c 73 20 77 with literals w
0df0: 69 64 65 72 20 74 68 61 6e 20 33 32 20 62 69 74 ider than 32 bit
0e00: 73 2e 20 20 2a 2f 0a 20 20 20 20 20 20 2f 2a 20 s. */. /*
0e10: 54 65 73 74 20 6c 69 74 65 72 61 6c 73 2e 20 20 Test literals.
0e20: 2a 2f 0a 20 20 20 20 20 20 6c 6f 6e 67 20 6c 6f */. long lo
0e30: 6e 67 20 69 6e 74 20 6c 6c 20 3d 20 39 32 32 33 ng int ll = 9223
0e40: 33 37 32 30 33 36 38 35 34 37 37 35 38 30 37 6c 372036854775807l
0e50: 6c 3b 0a 20 20 20 20 20 20 6c 6f 6e 67 20 6c 6f l;. long lo
0e60: 6e 67 20 69 6e 74 20 6e 6c 6c 20 3d 20 2d 39 32 ng int nll = -92
0e70: 32 33 33 37 32 30 33 36 38 35 34 37 37 35 38 30 2337203685477580
0e80: 37 4c 4c 3b 0a 20 20 20 20 20 20 75 6e 73 69 67 7LL;. unsig
0e90: 6e 65 64 20 6c 6f 6e 67 20 6c 6f 6e 67 20 69 6e ned long long in
0ea0: 74 20 75 6c 6c 20 3d 20 31 38 34 34 36 37 34 34 t ull = 18446744
0eb0: 30 37 33 37 30 39 35 35 31 36 31 35 55 4c 4c 3b 073709551615ULL;
0ec0: 0a 20 20 20 20 20 20 2f 2a 20 54 65 73 74 20 63 . /* Test c
0ed0: 6f 6e 73 74 61 6e 74 20 65 78 70 72 65 73 73 69 onstant expressi
0ee0: 6f 6e 73 2e 20 20 20 2a 2f 0a 20 20 20 20 20 20 ons. */.
0ef0: 74 79 70 65 64 65 66 20 69 6e 74 20 61 5b 28 28 typedef int a[((
0f00: 2d 39 32 32 33 33 37 32 30 33 36 38 35 34 37 37 -922337203685477
0f10: 35 38 30 37 4c 4c 20 3c 20 30 20 26 26 20 30 20 5807LL < 0 && 0
0f20: 3c 20 39 32 32 33 33 37 32 30 33 36 38 35 34 37 < 92233720368547
0f30: 37 35 38 30 37 6c 6c 29 0a 20 20 20 20 20 20 20 75807ll).
0f40: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 3f 20 ?
0f50: 31 20 3a 20 2d 31 29 5d 3b 0a 20 20 20 20 20 20 1 : -1)];.
0f60: 74 79 70 65 64 65 66 20 69 6e 74 20 62 5b 28 31 typedef int b[(1
0f70: 38 34 34 36 37 34 34 30 37 33 37 30 39 35 35 31 8446744073709551
0f80: 36 31 35 55 4c 4c 20 3c 3d 20 28 75 6e 73 69 67 615ULL <= (unsig
0f90: 6e 65 64 20 6c 6f 6e 67 20 6c 6f 6e 67 20 69 6e ned long long in
0fa0: 74 29 20 2d 31 0a 20 20 20 20 20 20 20 20 20 20 t) -1.
0fb0: 20 20 20 20 20 20 20 20 20 20 20 3f 20 31 20 3a ? 1 :
0fc0: 20 2d 31 29 5d 3b 0a 20 20 20 20 20 20 69 6e 74 -1)];. int
0fd0: 20 69 20 3d 20 36 33 3b 5d 5d 2c 0a 20 20 20 20 i = 63;]],.
0fe0: 5b 5b 2f 2a 20 54 65 73 74 20 61 76 61 69 6c 61 [[/* Test availa
0ff0: 62 69 6c 69 74 79 20 6f 66 20 72 75 6e 74 69 6d bility of runtim
1000: 65 20 72 6f 75 74 69 6e 65 73 20 66 6f 72 20 73 e routines for s
1010: 68 69 66 74 20 61 6e 64 20 64 69 76 69 73 69 6f hift and divisio
1020: 6e 2e 20 20 2a 2f 0a 20 20 20 20 20 20 6c 6f 6e n. */. lon
1030: 67 20 6c 6f 6e 67 20 69 6e 74 20 6c 6c 6d 61 78 g long int llmax
1040: 20 3d 20 39 32 32 33 33 37 32 30 33 36 38 35 34 = 9223372036854
1050: 37 37 35 38 30 37 6c 6c 3b 0a 20 20 20 20 20 20 775807ll;.
1060: 75 6e 73 69 67 6e 65 64 20 6c 6f 6e 67 20 6c 6f unsigned long lo
1070: 6e 67 20 69 6e 74 20 75 6c 6c 6d 61 78 20 3d 20 ng int ullmax =
1080: 31 38 34 34 36 37 34 34 30 37 33 37 30 39 35 35 1844674407370955
1090: 31 36 31 35 75 6c 6c 3b 0a 20 20 20 20 20 20 72 1615ull;. r
10a0: 65 74 75 72 6e 20 28 28 6c 6c 20 3c 3c 20 36 33 eturn ((ll << 63
10b0: 29 20 7c 20 28 6c 6c 20 3e 3e 20 36 33 29 20 7c ) | (ll >> 63) |
10c0: 20 28 6c 6c 20 3c 20 69 29 20 7c 20 28 6c 6c 20 (ll < i) | (ll
10d0: 3e 20 69 29 0a 20 20 20 20 20 20 20 20 20 20 20 > i).
10e0: 20 20 20 7c 20 28 6c 6c 6d 61 78 20 2f 20 6c 6c | (llmax / ll
10f0: 29 20 7c 20 28 6c 6c 6d 61 78 20 25 20 6c 6c 29 ) | (llmax % ll)
1100: 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7c . |
1110: 20 28 75 6c 6c 20 3c 3c 20 36 33 29 20 7c 20 28 (ull << 63) | (
1120: 75 6c 6c 20 3e 3e 20 36 33 29 20 7c 20 28 75 6c ull >> 63) | (ul
1130: 6c 20 3c 3c 20 69 29 20 7c 20 28 75 6c 6c 20 3e l << i) | (ull >
1140: 3e 20 69 29 0a 20 20 20 20 20 20 20 20 20 20 20 > i).
1150: 20 20 20 7c 20 28 75 6c 6c 6d 61 78 20 2f 20 75 | (ullmax / u
1160: 6c 6c 29 20 7c 20 28 75 6c 6c 6d 61 78 20 25 20 ll) | (ullmax %
1170: 75 6c 6c 29 29 3b 5d 5d 29 0a 5d 29 0a ull));]]).]).