
Module: ppl/ppl Branch: master Commit: a03382866a8d47ab99ecc7b1e542b5bbbcbcb799 URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=a03382866a8d4...
Author: Abramo Bagnara abramo.bagnara@gmail.com Date: Thu Feb 23 12:15:07 2012 +0100
Use always long for time related quantities.
---
src/Time.defs.hh | 16 ++++++++-------- src/Time.inlines.hh | 12 ++++++------ src/Watchdog.cc | 2 +- src/Watchdog.defs.hh | 6 +++--- src/Watchdog.inlines.hh | 8 ++++---- src/checked_ext.inlines.hh | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/Time.defs.hh b/src/Time.defs.hh index 6153722..8edb750 100644 --- a/src/Time.defs.hh +++ b/src/Time.defs.hh @@ -78,22 +78,22 @@ public: Time();
//! Constructor taking a number of centiseconds. - explicit Time(unsigned long centisecs); + explicit Time(long centisecs);
//! Constructor with seconds and microseconds. - Time(unsigned long s, unsigned long m); + Time(long s, long m);
/*! \brief Returns the number of whole seconds contained in the represented time interval. */ - unsigned long seconds() const; + long seconds() const;
/*! \brief Returns the number of microseconds that, when added to the number of seconds returned by seconds(), give the represent time interval. */ - unsigned long microseconds() const; + long microseconds() const;
//! Adds \p y to \p *this. Time& operator+=(const Time& y); @@ -109,16 +109,16 @@ public:
private: //! Number of microseconds in a second. - static const unsigned long USECS_PER_SEC = 1000000UL; + static const long USECS_PER_SEC = 1000000L;
//! Number of centiseconds in a second. - static const unsigned long CSECS_PER_SEC = 100UL; + static const long CSECS_PER_SEC = 100L;
//! Number of seconds. - unsigned long secs; + long secs;
//! Number of microseconds. - unsigned long microsecs; + long microsecs; };
#include "Time.inlines.hh" diff --git a/src/Time.inlines.hh b/src/Time.inlines.hh index e7e716d..af4bc5b 100644 --- a/src/Time.inlines.hh +++ b/src/Time.inlines.hh @@ -39,14 +39,14 @@ Time::Time() }
inline -Time::Time(unsigned long centisecs) +Time::Time(long centisecs) : secs(centisecs / CSECS_PER_SEC), microsecs((centisecs % CSECS_PER_SEC) * (USECS_PER_SEC/CSECS_PER_SEC)) { assert(OK()); }
inline -Time::Time(unsigned long s, unsigned long m) +Time::Time(long s, long m) : secs(s), microsecs(m) { if (microsecs >= USECS_PER_SEC) { @@ -56,20 +56,20 @@ Time::Time(unsigned long s, unsigned long m) assert(OK()); }
-inline unsigned long +inline long Time::seconds() const { return secs; }
-inline unsigned long +inline long Time::microseconds() const { return microsecs; }
inline Time& Time::operator+=(const Time& y) { - unsigned long r_secs = secs + y.secs; - unsigned long r_microsecs = microsecs + y.microsecs; + long r_secs = secs + y.secs; + long r_microsecs = microsecs + y.microsecs; if (r_microsecs >= USECS_PER_SEC) { ++r_secs; r_microsecs %= USECS_PER_SEC; diff --git a/src/Watchdog.cc b/src/Watchdog.cc index 504beee..b038e88 100644 --- a/src/Watchdog.cc +++ b/src/Watchdog.cc @@ -166,7 +166,7 @@ PPL::PPL_handle_timeout(int signum) { }
PPL::Watchdog::WD_Pending_List::Iterator -PPL::Watchdog::new_watchdog_event(unsigned int csecs, +PPL::Watchdog::new_watchdog_event(long csecs, const WD_Handler& handler, bool& expired_flag) { using namespace Implementation::Watchdog; diff --git a/src/Watchdog.defs.hh b/src/Watchdog.defs.hh index 8a95c9e..338e27b 100644 --- a/src/Watchdog.defs.hh +++ b/src/Watchdog.defs.hh @@ -51,13 +51,13 @@ struct Watchdog_Traits { class Watchdog { public: template <typename Flag_Base, typename Flag> - Watchdog(unsigned int csecs, const Flag_Base* volatile& holder, Flag& flag); + Watchdog(long csecs, const Flag_Base* volatile& holder, Flag& flag);
/*! \brief Constructor: if not reset, the watchdog will trigger after \p csecs centiseconds, invoking handler \p function. */ - Watchdog(unsigned int csecs, void (*function)()); + Watchdog(long csecs, void (*function)());
//! Destructor. ~Watchdog(); @@ -122,7 +122,7 @@ private:
//! Handles the addition of a new watchdog event. static WD_Pending_List::Iterator - new_watchdog_event(unsigned int csecs, + new_watchdog_event(long csecs, const WD_Handler& handler, bool& expired_flag);
diff --git a/src/Watchdog.inlines.hh b/src/Watchdog.inlines.hh index 303f268..c1262b5 100644 --- a/src/Watchdog.inlines.hh +++ b/src/Watchdog.inlines.hh @@ -33,7 +33,7 @@ namespace Parma_Polyhedra_Library { #if PPL_HAVE_DECL_SETITIMER && PPL_HAVE_DECL_SIGACTION
template <typename Flag_Base, typename Flag> -Watchdog::Watchdog(unsigned int csecs, +Watchdog::Watchdog(long csecs, const Flag_Base* volatile& holder, Flag& flag) : expired(false), @@ -49,7 +49,7 @@ Watchdog::Watchdog(unsigned int csecs, }
inline -Watchdog::Watchdog(unsigned int csecs, void (*function)()) +Watchdog::Watchdog(long csecs, void (*function)()) : expired(false), handler(*new Implementation::Watchdog::Handler_Function(function)) { if (csecs == 0) @@ -78,7 +78,7 @@ Watchdog::reschedule() { #else // !PPL_HAVE_DECL_SETITIMER !! !PPL_HAVE_DECL_SIGACTION
template <typename Flag_Base, typename Flag> -Watchdog::Watchdog(unsigned int /* csecs */, +Watchdog::Watchdog(long /* csecs */, const Flag_Base* volatile& /* holder */, Flag& /* flag */) { throw std::logic_error("PPL::Watchdog::Watchdog objects not supported:" @@ -86,7 +86,7 @@ Watchdog::Watchdog(unsigned int /* csecs */, }
inline -Watchdog::Watchdog(unsigned int /* csecs */, void (* /* function */)()) { +Watchdog::Watchdog(long /* csecs */, void (* /* function */)()) { throw std::logic_error("PPL::Watchdog::Watchdog objects not supported:" " system does not provide setitimer()"); } diff --git a/src/checked_ext.inlines.hh b/src/checked_ext.inlines.hh index c3c97d9..f02d9be 100644 --- a/src/checked_ext.inlines.hh +++ b/src/checked_ext.inlines.hh @@ -675,7 +675,7 @@ mul_2exp_ext(To& to, const From& x, unsigned int exp, Rounding_Dir dir) { template <typename To_Policy, typename From_Policy, typename To, typename From> inline Result -div_2exp_ext(To& to, const From& x, int exp, Rounding_Dir dir) { +div_2exp_ext(To& to, const From& x, unsigned int exp, Rounding_Dir dir) { if (!ext_to_handle<From_Policy>(x)) goto native; if (is_nan<From_Policy>(x))