From 49daa856795e435ad1d22fa29c040b19851d692e Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 18 Sep 2008 22:25:46 -0300 Subject: [PATCH] Define our own U64_MAX maximum. --- flower/include/flower-proto.hh | 4 ++++ flower/include/rational.hh | 3 ++- flower/rational.cc | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/flower/include/flower-proto.hh b/flower/include/flower-proto.hh index 6aec04e5d0..794ab1ad20 100644 --- a/flower/include/flower-proto.hh +++ b/flower/include/flower-proto.hh @@ -38,6 +38,10 @@ typedef unsigned U32; typedef int I32; typedef unsigned long long U64; +/* We should really use LLONG_MAX; unfortunately, this appears not to + be defined for the gub x-compiler. +*/ +const U64 U64_MAX = (~0ULL); struct File_storage; struct Mapped_file_storage; diff --git a/flower/include/rational.hh b/flower/include/rational.hh index 57bd23593b..fdc3b68fab 100644 --- a/flower/include/rational.hh +++ b/flower/include/rational.hh @@ -57,6 +57,7 @@ public: Rational (); Rational (int); Rational (I64); + Rational (U64); explicit Rational (I64, I64); explicit Rational (double); Rational (Rational const &r) { copy (r);} @@ -101,6 +102,6 @@ ostream & operator << (ostream &, Rational); #endif -const Rational infinity_rat (LLONG_MAX); +const Rational infinity_rat (U64_MAX); #endif // RATIONAL_HH diff --git a/flower/rational.cc b/flower/rational.cc index 6046374630..ff32704f85 100644 --- a/flower/rational.cc +++ b/flower/rational.cc @@ -76,6 +76,13 @@ Rational::Rational (I64 n) den_ = 1; } +Rational::Rational (U64 n) +{ + sign_ = 1; + num_ = n; + den_ = 1; +} + Rational::Rational (int n) { sign_ = ::sign (n); -- 2.39.2