Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc34ed86

Browse files
committed
Allow long long on BSDI.
1 parent6d3a548 commitc34ed86

File tree

2 files changed

+47
-4
lines changed

2 files changed

+47
-4
lines changed

‎src/configure.in

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,43 @@ int does_int64_work()
606606
main() {
607607
exit(! does_int64_work());
608608
}],
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)],
610646
AC_MSG_RESULT(no),
611647
AC_MSG_RESULT(assuming not on target machine))
612648

‎src/include/utils/int8.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* Copyright (c) 1994, Regents of the University of California
88
*
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 $
1010
*
1111
* NOTES
1212
* These data types are supported on all 64-bit architectures, and may
@@ -29,11 +29,17 @@ typedef long int int64;
2929

3030
#defineINT64_FORMAT "%ld"
3131
#else
32-
#ifdefHAVE_LONG_LONG_INT_64
32+
#ifdefHAVE_LONG_LONG_INT_64_Ld
3333
/* We have working support for "long long int", use that */
3434
typedeflong longintint64;
3535

36-
#defineINT64_FORMAT "%lld"
36+
#defineINT64_FORMAT "%Ld"
37+
#else
38+
#ifdefHAVE_LONG_LONG_INT_64_qd
39+
/* We have working support for "long long int", use that */
40+
typedeflong longintint64;
41+
42+
#defineINT64_FORMAT "%qd"
3743
#else
3844
/* Won't actually work, but fall back to long int so that int8.c compiles */
3945
typedeflongintint64;
@@ -42,6 +48,7 @@ typedef long int int64;
4248
#defineINT64_IS_BUSTED
4349
#endif
4450
#endif
51+
#endif
4552

4653
externint64*int8in(char*str);
4754
externchar*int8out(int64*val);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp