20 #include "ns3/core-config.h" 21 #if !defined(INT64X64_DOUBLE_H) && (defined (INT64X64_USE_DOUBLE) || defined(PYTHON_SCAN)) 22 #define INT64X64_DOUBLE_H 44 static const uint64_t
HP_MASK_LO = 0xffffffffffffffffULL;
57 #define HP_MAX_64 (std::pow (2.0L, 64)) 102 :
_v (static_cast<double> (v)) {}
108 :
_v (static_cast<double> (v)) {}
118 const bool negative = hi < 0;
119 const long double hild =
static_cast<long double> (hi);
120 const long double fhi = negative ? -hild : hild;
122 _v = negative ? - fhi : fhi;
162 const bool negative =
_v < 0;
163 const long double v = negative ? -
_v :
_v;
166 long double flo = std::modf (v, &fhi);
175 const long double round = 0.5;
177 int64_t hi =
static_cast<int64_t
> (fhi);
178 uint64_t lo =
static_cast<uint64_t
> (flo);
193 return std::make_pair (hi, lo);
266 return lhs._v == rhs._v;
272 inline bool operator < (
const int64x64_t & lhs,
const int64x64_t & rhs)
274 return lhs._v < rhs._v;
280 inline bool operator > (
const int64x64_t & lhs,
const int64x64_t & rhs)
282 return lhs._v > rhs._v;
289 inline int64x64_t &
operator += (int64x64_t & lhs,
const int64x64_t & rhs)
298 inline int64x64_t &
operator -= (int64x64_t & lhs,
const int64x64_t & rhs)
307 inline int64x64_t &
operator *= (int64x64_t & lhs,
const int64x64_t & rhs)
316 inline int64x64_t &
operator /= (int64x64_t & lhs,
const int64x64_t & rhs)
326 inline int64x64_t
operator + (
const int64x64_t & lhs)
334 inline int64x64_t
operator - (
const int64x64_t & lhs)
336 return int64x64_t (-lhs._v);
342 inline int64x64_t
operator ! (
const int64x64_t & lhs)
344 return int64x64_t (!lhs._v);
int64x64_t & operator+=(int64x64_t &lhs, const int64x64_t &rhs)
Compound addition operator.
int64x64_t operator+(const int64x64_t &lhs)
Unary plus operator.
High precision numerical type, implementing Q64.64 fixed precision.
int64x64_t & operator*=(int64x64_t &lhs, const int64x64_t &rhs)
Compound multiplication operator.
int64x64_t operator-(const int64x64_t &lhs)
Unary negation operator (change sign operator).
impl_type
Type tag for the underlying implementation.
void MulByInvert(const int64x64_t &o)
Multiply this value by a Q0.128 value, presumably representing an inverse, completing a division oper...
friend int64x64_t operator!(const int64x64_t &lhs)
Logical not operator.
friend int64x64_t & operator*=(int64x64_t &lhs, const int64x64_t &rhs)
Compound multiplication operator.
friend bool operator==(const int64x64_t &lhs, const int64x64_t &rhs)
Equality operator.
bool operator<(const EventId &a, const EventId &b)
std::pair< int64_t, uint64_t > GetHighLow(void) const
Get the high and low portions of this value.
int64x64_t(long int v)
Construct from an integral type.
friend int64x64_t & operator/=(int64x64_t &lhs, const int64x64_t &rhs)
Compound division operator.
int64x64_t(long double v)
Construct from a floating point value.
static const uint64_t HP_MASK_LO
Mask for fraction part.
int128_t _v
The Q64.64 value.
friend int64x64_t & operator-=(int64x64_t &lhs, const int64x64_t &rhs)
Compound subtraction operator.
int64x64_t(unsigned long long int v)
Construct from an integral type.
int64x64_t(unsigned long int v)
Construct from an integral type.
int64x64_t()
Default constructor.
#define HP_MAX_64
Floating point value of HP_MASK_LO + 1 We really want:
Every class exported by the ns3 library is enclosed in the ns3 namespace.
int64x64_t(int v)
Construct from an integral type.
int64x64_t(double v)
Construct from a floating point value.
long double _v
The Q64.64 value.
int64x64_t & operator=(const int64x64_t &o)
Assignment.
int64x64_t(int64_t hi, uint64_t lo)
Construct from explicit high and low values.
Native int128_t implementation.
static int64x64_t Invert(uint64_t v)
Compute the inverse of an integer value.
friend bool operator<(const int64x64_t &lhs, const int64x64_t &rhs)
Less than operator.
uint64_t GetLow(void) const
Get the fractional portion of this value, unscaled.
bool operator>(const int64x64_t &lhs, const int64x64_t &rhs)
Greater operator.
bool operator==(const EventId &a, const EventId &b)
Cairo wideint implementation.
double GetDouble(void) const
Get this value as a double.
int64x64_t & operator-=(int64x64_t &lhs, const int64x64_t &rhs)
Compound subtraction operator.
friend int64x64_t & operator+=(int64x64_t &lhs, const int64x64_t &rhs)
Compound addition operator.
int64x64_t(long long int v)
Construct from an integral type.
int64x64_t(unsigned int v)
Construct from an integral type.
friend int64x64_t operator-(const int64x64_t &lhs)
Unary negation operator (change sign operator).
int64x64_t & operator/=(int64x64_t &lhs, const int64x64_t &rhs)
Compound division operator.
friend bool operator>(const int64x64_t &lhs, const int64x64_t &rhs)
Greater operator.
int64x64_t(const int64x64_t &o)
Copy constructor.
long double implementation.
int64x64_t operator!(const int64x64_t &lhs)
Logical not operator.
int64_t GetHigh(void) const
Get the integer portion.
static enum impl_type implementation
Type tag for this implementation.