summaryrefslogtreecommitdiffstats
path: root/gl/m4/longlong.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/longlong.m4')
-rw-r--r--gl/m4/longlong.m466
1 files changed, 33 insertions, 33 deletions
diff --git a/gl/m4/longlong.m4 b/gl/m4/longlong.m4
index eedc8d5..cca3c1a 100644
--- a/gl/m4/longlong.m4
+++ b/gl/m4/longlong.m4
@@ -1,5 +1,5 @@
1# longlong.m4 serial 14 1# longlong.m4 serial 14
2dnl Copyright (C) 1999-2007, 2009 Free Software Foundation, Inc. 2dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved. 5dnl with or without modifications, as long as this notice is preserved.
@@ -20,30 +20,30 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
20 [AC_LINK_IFELSE( 20 [AC_LINK_IFELSE(
21 [_AC_TYPE_LONG_LONG_SNIPPET], 21 [_AC_TYPE_LONG_LONG_SNIPPET],
22 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. 22 [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004.
23 dnl If cross compiling, assume the bug isn't important, since 23 dnl If cross compiling, assume the bug isn't important, since
24 dnl nobody cross compiles for this platform as far as we know. 24 dnl nobody cross compiles for this platform as far as we know.
25 AC_RUN_IFELSE( 25 AC_RUN_IFELSE(
26 [AC_LANG_PROGRAM( 26 [AC_LANG_PROGRAM(
27 [[@%:@include <limits.h> 27 [[@%:@include <limits.h>
28 @%:@ifndef LLONG_MAX 28 @%:@ifndef LLONG_MAX
29 @%:@ define HALF \ 29 @%:@ define HALF \
30 (1LL << (sizeof (long long int) * CHAR_BIT - 2)) 30 (1LL << (sizeof (long long int) * CHAR_BIT - 2))
31 @%:@ define LLONG_MAX (HALF - 1 + HALF) 31 @%:@ define LLONG_MAX (HALF - 1 + HALF)
32 @%:@endif]], 32 @%:@endif]],
33 [[long long int n = 1; 33 [[long long int n = 1;
34 int i; 34 int i;
35 for (i = 0; ; i++) 35 for (i = 0; ; i++)
36 { 36 {
37 long long int m = n << i; 37 long long int m = n << i;
38 if (m >> i != n) 38 if (m >> i != n)
39 return 1; 39 return 1;
40 if (LLONG_MAX / 2 < m) 40 if (LLONG_MAX / 2 < m)
41 break; 41 break;
42 } 42 }
43 return 0;]])], 43 return 0;]])],
44 [ac_cv_type_long_long_int=yes], 44 [ac_cv_type_long_long_int=yes],
45 [ac_cv_type_long_long_int=no], 45 [ac_cv_type_long_long_int=no],
46 [ac_cv_type_long_long_int=yes])], 46 [ac_cv_type_long_long_int=yes])],
47 [ac_cv_type_long_long_int=no])]) 47 [ac_cv_type_long_long_int=no])])
48 if test $ac_cv_type_long_long_int = yes; then 48 if test $ac_cv_type_long_long_int = yes; then
49 AC_DEFINE([HAVE_LONG_LONG_INT], [1], 49 AC_DEFINE([HAVE_LONG_LONG_INT], [1],
@@ -83,24 +83,24 @@ AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET],
83[ 83[
84 AC_LANG_PROGRAM( 84 AC_LANG_PROGRAM(
85 [[/* For now, do not test the preprocessor; as of 2007 there are too many 85 [[/* For now, do not test the preprocessor; as of 2007 there are too many
86 implementations with broken preprocessors. Perhaps this can 86 implementations with broken preprocessors. Perhaps this can
87 be revisited in 2012. In the meantime, code should not expect 87 be revisited in 2012. In the meantime, code should not expect
88 #if to work with literals wider than 32 bits. */ 88 #if to work with literals wider than 32 bits. */
89 /* Test literals. */ 89 /* Test literals. */
90 long long int ll = 9223372036854775807ll; 90 long long int ll = 9223372036854775807ll;
91 long long int nll = -9223372036854775807LL; 91 long long int nll = -9223372036854775807LL;
92 unsigned long long int ull = 18446744073709551615ULL; 92 unsigned long long int ull = 18446744073709551615ULL;
93 /* Test constant expressions. */ 93 /* Test constant expressions. */
94 typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) 94 typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
95 ? 1 : -1)]; 95 ? 1 : -1)];
96 typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 96 typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
97 ? 1 : -1)]; 97 ? 1 : -1)];
98 int i = 63;]], 98 int i = 63;]],
99 [[/* Test availability of runtime routines for shift and division. */ 99 [[/* Test availability of runtime routines for shift and division. */
100 long long int llmax = 9223372036854775807ll; 100 long long int llmax = 9223372036854775807ll;
101 unsigned long long int ullmax = 18446744073709551615ull; 101 unsigned long long int ullmax = 18446744073709551615ull;
102 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) 102 return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
103 | (llmax / ll) | (llmax % ll) 103 | (llmax / ll) | (llmax % ll)
104 | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) 104 | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
105 | (ullmax / ull) | (ullmax % ull));]]) 105 | (ullmax / ull) | (ullmax % ull));]])
106]) 106])