20 #include "ns3/core-config.h"
21 #if !defined(INT64X64_DOUBLE_H) && (defined (INT64X64_USE_DOUBLE) || defined(PYTHON_SCAN))
22 #define INT64X64_DOUBLE_H
38 static const uint64_t
HP_MASK_LO = 0xffffffffffffffffULL;
51 #define HP_MAX_64 (std::pow (2.0L, 64))
110 explicit inline int64x64_t (int64_t hi, uint64_t lo)
112 const bool negative = hi < 0;
113 const long double fhi = negative ? -hi : hi;
115 _v = negative ? - fhi : fhi;
153 std::pair<int64_t, uint64_t> GetHighLow (
void)
const
155 const bool negative =
_v < 0;
156 const long double v = negative ? -
_v :
_v;
159 long double flo = std::modf (v, &fhi);
168 const long double round = 0.5;
186 return std::make_pair (hi, lo);
194 inline int64_t
GetHigh (
void)
const
196 return GetHighLow ().first;
203 inline uint64_t
GetLow (
void)
const
205 return GetHighLow ().second;
257 inline bool operator == (
const int64x64_t & lhs,
const int64x64_t & rhs)
259 return lhs._v == rhs._v;
265 inline bool operator < (
const int64x64_t & lhs,
const int64x64_t & rhs)
267 return lhs._v < rhs._v;
273 inline bool operator > (
const int64x64_t & lhs,
const int64x64_t & rhs)
275 return lhs._v > rhs._v;
282 inline int64x64_t &
operator += (int64x64_t & lhs,
const int64x64_t & rhs)
291 inline int64x64_t &
operator -= (int64x64_t & lhs,
const int64x64_t & rhs)
300 inline int64x64_t &
operator *= (int64x64_t & lhs,
const int64x64_t & rhs)
309 inline int64x64_t &
operator /= (int64x64_t & lhs,
const int64x64_t & rhs)
319 inline int64x64_t
operator + (
const int64x64_t & lhs)
327 inline int64x64_t
operator - (
const int64x64_t & lhs)
329 return int64x64_t (-lhs._v);
335 inline int64x64_t
operator ! (
const int64x64_t & lhs)
337 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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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.
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.