autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Check that long long int is at least 64 bits wide


From: Paul Eggert
Subject: Check that long long int is at least 64 bits wide
Date: Sun, 02 Jul 2006 00:36:37 -0700
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

I installed this, imported from gnulib:

2006-07-02  Paul Eggert  <address@hidden>

        * lib/autoconf/types.m4 (AC_TYPE_LONG_LONG_INT):
        Require that long long int be at least 64 bits wide.  C99 requires
        this and enough programs depend on it so we should check for it.
        Bruno Haible reports in
        <http://lists.gnu.org/archive/html/bug-gnulib/2006-06/msg00286.html>
        that long long int is 32 bits wide with some nonstandard compilers.
        (AC_TYPE_UNSIGNED_LONG_LONG_INT): Likewise.

--- lib/autoconf/types.m4       19 Jun 2006 18:28:12 -0000      1.39
+++ lib/autoconf/types.m4       2 Jul 2006 07:34:41 -0000
@@ -472,9 +472,15 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
   AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int],
     [AC_LINK_IFELSE(
        [AC_LANG_PROGRAM(
-         [long long int ll = 1LL; int i = 63;],
-         [long long int llmax = (long long int) -1;
-          return ll << i | ll >> i | llmax / ll | llmax % ll;])],
+         [[long long int ll = 9223372036854775807ll;
+           long long int nll = -9223372036854775807LL;
+           typedef int a[((-9223372036854775807LL < 0
+                           && 0 < 9223372036854775807ll)
+                          ? 1 : -1)];
+           int i = 63;]],
+         [[long long int llmax = 9223372036854775807ll;
+           return (ll << 63 | ll >> 63 | ll < i | ll > i
+                   | llmax / ll | llmax % ll);]])],
        [ac_cv_type_long_long_int=yes],
        [ac_cv_type_long_long_int=no])])
   if test $ac_cv_type_long_long_int = yes; then
@@ -492,9 +498,13 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT
     [ac_cv_type_unsigned_long_long_int],
     [AC_LINK_IFELSE(
        [AC_LANG_PROGRAM(
-         [unsigned long long int ull = 1ULL; int i = 63;],
-         [unsigned long long int ullmax = (unsigned long long int) -1;
-          return ull << i | ull >> i | ullmax / ull | ullmax % ull;])],
+         [[unsigned long long int ull = 18446744073709551615ULL;
+           typedef int a[(18446744073709551615ULL <= (unsigned long long int) 
-1
+                          ? 1 : -1)];
+          int i = 63;]],
+         [[unsigned long long int ullmax = 18446744073709551615ull;
+           return (ull << 63 | ull >> 63 | ull << i | ull >> i
+                   | ullmax / ull | ullmax % ull);]])],
        [ac_cv_type_unsigned_long_long_int=yes],
        [ac_cv_type_unsigned_long_long_int=no])])
   if test $ac_cv_type_unsigned_long_long_int = yes; then




reply via email to

[Prev in Thread] Current Thread [Next in Thread]