1 #include "ns3/core-config.h"
2 #if !defined(INT64X64_DOUBLE_H) && (defined (INT64X64_USE_DOUBLE) || defined(PYTHON_SCAN))
3 #define INT64X64_DOUBLE_H
19 static const uint64_t
HP_MASK_LO = 0xffffffffffffffffULL;
32 #define HP_MAX_64 (std::pow (2.0L, 64))
91 explicit inline int64x64_t (int64_t hi, uint64_t lo)
93 const bool negative = hi < 0;
94 const long double fhi = negative ? -hi : hi;
96 _v = negative ? - fhi : fhi;
134 std::pair<int64_t, uint64_t> GetHighLow (
void)
const
136 const bool negative =
_v < 0;
137 const long double v = negative ? -
_v :
_v;
140 long double flo = std::modf (v, &fhi);
149 const long double round = 0.5;
167 return std::make_pair (hi, lo);
175 inline int64_t
GetHigh (
void)
const
177 return GetHighLow ().first;
184 inline uint64_t
GetLow (
void)
const
186 return GetHighLow ().second;
238 inline bool operator == (
const int64x64_t & lhs,
const int64x64_t & rhs)
240 return lhs._v == rhs._v;
246 inline bool operator < (
const int64x64_t & lhs,
const int64x64_t & rhs)
248 return lhs._v < rhs._v;
254 inline bool operator > (
const int64x64_t & lhs,
const int64x64_t & rhs)
256 return lhs._v > rhs._v;
263 inline int64x64_t &
operator += (int64x64_t & lhs,
const int64x64_t & rhs)
272 inline int64x64_t &
operator -= (int64x64_t & lhs,
const int64x64_t & rhs)
281 inline int64x64_t &
operator *= (int64x64_t & lhs,
const int64x64_t & rhs)
290 inline int64x64_t &
operator /= (int64x64_t & lhs,
const int64x64_t & rhs)
300 inline int64x64_t
operator + (
const int64x64_t & lhs)
308 inline int64x64_t
operator - (
const int64x64_t & lhs)
310 return int64x64_t (-lhs._v);
316 inline int64x64_t
operator ! (
const int64x64_t & lhs)
318 return int64x64_t (!lhs._v);
long double implementation
uint64_t GetLow(void) const
Get the fractional portion of this value, unscaled.
int64x64_t operator+(const int64x64_t &lhs)
Unary plus operator.
int64x64_t & operator/=(int64x64_t &lhs, const int64x64_t &rhs)
Compound division operator.
static int64x64_t Invert(const uint64_t v)
Compute the inverse of an integer value.
int64x64_t operator-(const int64x64_t &lhs)
Unary negation operator (change sign operator)
impl_type
Type tag for the underlying implementation.
int64x64_t & operator+=(int64x64_t &lhs, const int64x64_t &rhs)
Compound addition operator.
static enum impl_type implementation
Type tag for this implementation.
void MulByInvert(const int64x64_t &o)
Multiply this value by a Q0.128 value, presumably representing an inverse, completing a division oper...
double GetDouble(void) const
Get this value as a double.
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.
friend int64x64_t & operator/=(int64x64_t &lhs, const int64x64_t &rhs)
Compound division operator.
int128_t _v
The Q64.64 value.
friend int64x64_t & operator-=(int64x64_t &lhs, const int64x64_t &rhs)
Compound subtraction operator.
int64x64_t()
Default constructor.
bool operator<(const int64x64_t &lhs, const int64x64_t &rhs)
Less than operator.
int64x64_t & operator*=(int64x64_t &lhs, const int64x64_t &rhs)
Compound multiplication operator.
Native int128_t implementation.
static const uint64_t HP_MASK_LO
Mask for fraction part.
int64x64_t & operator=(const int64x64_t &o)
Assignment.
#define HP_MAX_64
Floating point value of HP_MASK_LO + 1 We really want:
friend bool operator<(const int64x64_t &lhs, const int64x64_t &rhs)
Less than operator.
bool operator>(const int64x64_t &lhs, const int64x64_t &rhs)
Greater operator.
bool operator==(const EventId &a, const EventId &b)
int64_t GetHigh(void) const
Get the integer portion.
cairo wideint implementation
friend int64x64_t & operator+=(int64x64_t &lhs, const int64x64_t &rhs)
Compound addition operator.
friend int64x64_t operator-(const int64x64_t &lhs)
Unary negation operator (change sign operator)
friend bool operator>(const int64x64_t &lhs, const int64x64_t &rhs)
Greater operator.
int64x64_t operator!(const int64x64_t &lhs)
Logical not operator.
int64x64_t & operator-=(int64x64_t &lhs, const int64x64_t &rhs)
Compound subtraction operator.