File tree 2 files changed +47
-4
lines changed
2 files changed +47
-4
lines changed Original file line number Diff line number Diff line change @@ -606,7 +606,43 @@ int does_int64_work()
606
606
main() {
607
607
exit(! does_int64_work());
608
608
}],
609
- [AC_DEFINE(HAVE_LONG_LONG_INT_64) AC_MSG_RESULT(yes)],
609
+ [AC_DEFINE(HAVE_LONG_LONG_INT_64_Ld) AC_MSG_RESULT(yes)],
610
+ AC_MSG_RESULT(no),
611
+ AC_MSG_RESULT(assuming not on target machine))
612
+
613
+ AC_TRY_RUN([#include <stdio.h>
614
+ typedef long long int int64;
615
+ #define INT64_FORMAT "%qd"
616
+
617
+ int64 a = 20000001;
618
+ int64 b = 40000005;
619
+
620
+ int does_int64_work()
621
+ {
622
+ int64 c,d,e;
623
+ char buf[100];
624
+
625
+ if (sizeof(int64) != 8)
626
+ return 0; /* doesn't look like the right size */
627
+
628
+ /* we do perfunctory checks on multiply, divide, sprintf, sscanf */
629
+ c = a * b;
630
+ sprintf(buf, INT64_FORMAT, c);
631
+ if (strcmp(buf, "800000140000005") != 0)
632
+ return 0; /* either multiply or sprintf is busted */
633
+ if (sscanf(buf, INT64_FORMAT, &d) != 1)
634
+ return 0;
635
+ if (d != c)
636
+ return 0;
637
+ e = d / b;
638
+ if (e != a)
639
+ return 0;
640
+ return 1;
641
+ }
642
+ main() {
643
+ exit(! does_int64_work());
644
+ }],
645
+ [AC_DEFINE(HAVE_LONG_LONG_INT_64_qd) AC_MSG_RESULT(yes)],
610
646
AC_MSG_RESULT(no),
611
647
AC_MSG_RESULT(assuming not on target machine))
612
648
Original file line number Diff line number Diff line change 6
6
*
7
7
* Copyright (c) 1994, Regents of the University of California
8
8
*
9
- * $Id: int8.h,v 1.4 1998/09/05 01:19:38 thomas Exp $
9
+ * $Id: int8.h,v 1.5 1998/09/10 03:27:09 momjian Exp $
10
10
*
11
11
* NOTES
12
12
* These data types are supported on all 64-bit architectures, and may
@@ -29,11 +29,17 @@ typedef long int int64;
29
29
30
30
#define INT64_FORMAT "%ld"
31
31
#else
32
- #ifdef HAVE_LONG_LONG_INT_64
32
+ #ifdef HAVE_LONG_LONG_INT_64_Ld
33
33
/* We have working support for "long long int", use that */
34
34
typedef long long int int64 ;
35
35
36
- #define INT64_FORMAT "%lld"
36
+ #define INT64_FORMAT "%Ld"
37
+ #else
38
+ #ifdef HAVE_LONG_LONG_INT_64_qd
39
+ /* We have working support for "long long int", use that */
40
+ typedef long long int int64 ;
41
+
42
+ #define INT64_FORMAT "%qd"
37
43
#else
38
44
/* Won't actually work, but fall back to long int so that int8.c compiles */
39
45
typedef long int int64 ;
@@ -42,6 +48,7 @@ typedef long int int64;
42
48
#define INT64_IS_BUSTED
43
49
#endif
44
50
#endif
51
+ #endif
45
52
46
53
extern int64 * int8in (char * str );
47
54
extern char * int8out (int64 * val );
You can’t perform that action at this time.
0 commit comments