00001 #ifndef CLASSLIB_LONG_LONG_H
00002 # define CLASSLIB_LONG_LONG_H
00003
00004
00005
00006 # include "classlib/utils/iosfwd.h"
00007 # include <limits.h>
00008
00009
00010
00019 # if HAVE_LONG_LONG
00020 # define LONG_LONG_CONST(n) n ## LL
00021 # define ULONG_LONG_CONST(n) n ## ULL
00022 # if ! defined ULONG_LONG_MAX && defined ULLONG_MAX // solaris
00023 # define ULONG_LONG_MAX ULLONG_MAX
00024 # define LONG_LONG_MAX LLONG_MAX
00025 # define LONG_LONG_MIN LLONG_MIN
00026 # endif
00027 # elif HAVE_INT64
00028 # define LONG_LONG_CONST(n) n ## i64
00029 # define ULONG_LONG_CONST(n) n ## ui64
00030
00031 # define LONG_LONG_MAX 9223372036854775807i64
00032 # define LONG_LONG_MIN (-LONG_LONG_MAX-1)
00033 # define ULONG_LONG_MAX (LONG_LONG_MAX * 2ui64 + 1)
00034 # endif
00035
00036
00037
00038
00039 namespace lat {
00040 # if HAVE_LONG_LONG
00041 typedef long long LongLong;
00042 typedef unsigned long long ULongLong;
00043 # elif HAVE_INT64
00044 typedef __int64 LongLong;
00045 typedef unsigned __int64 ULongLong;
00046 # else
00047 typedef long LongLong;
00048 typedef unsigned long ULongLong;
00049 # endif
00050 }
00051
00052
00053
00054
00055 #if !HAVE_OSTREAM_LONG_LONG_OVERLOAD && ! defined HAVE_INT64
00056 std::ostream &operator<< (std::ostream &s, long long n);
00057 std::ostream &operator<< (std::ostream &s, unsigned long long n);
00058 #endif
00059
00060
00061
00062
00063
00064 #endif // CLASSLIB_LONG_LONG_H