20 #include "ns3/core-config.h"
21 #if !defined(INT64X64_CAIRO_H) && defined (INT64X64_USE_CAIRO) && !defined(PYTHON_SCAN)
22 #define INT64X64_CAIRO_H
45 static const uint64_t
HP_MASK_LO = 0xffffffffffffffffULL;
58 #define HP_MAX_64 (std::pow (2.0L, 64))
97 const bool negative = value < 0;
98 const long double v = negative ? -value : value;
101 long double flo = std::modf (v, &fhi);
110 const long double round = 0.5;
168 explicit inline int64x64_t (
const int64_t hi,
const uint64_t lo)
203 const long double fhi =
static_cast<long double> (value.
hi);
205 long double retval = fhi;
207 retval = negative ? -retval : retval;
208 return static_cast<double> (retval);
217 return (int64_t)
_v.hi;
238 int64_t retval = value.
hi;
239 retval = negative ? - retval : retval;
253 cairo_uint128_t half {1ULL << 63, 0};
255 int64_t retval = value.hi;
256 retval = negative ? - retval : retval;
359 static cairo_uint128_t
Umul (
const cairo_uint128_t a,
const cairo_uint128_t b);
367 static cairo_uint128_t
Udiv (
const cairo_uint128_t a,
const cairo_uint128_t b);
377 static cairo_uint128_t
UmulByInvert (
const cairo_uint128_t a,
const cairo_uint128_t b);
402 inline bool operator < (
const int64x64_t & lhs,
const int64x64_t & rhs)
413 inline bool operator > (
const int64x64_t & lhs,
const int64x64_t & rhs)
425 inline int64x64_t &
operator += (int64x64_t & lhs,
const int64x64_t & rhs)
437 inline int64x64_t &
operator -= (int64x64_t & lhs,
const int64x64_t & rhs)
449 inline int64x64_t &
operator *= (int64x64_t & lhs,
const int64x64_t & rhs)
461 inline int64x64_t &
operator /= (int64x64_t & lhs,
const int64x64_t & rhs)
473 inline int64x64_t
operator + (
const int64x64_t & lhs)
483 inline int64x64_t
operator - (
const int64x64_t & lhs)
485 int64x64_t tmp = lhs;
495 inline int64x64_t
operator ! (
const int64x64_t & lhs)
497 return (lhs == int64x64_t ()) ? int64x64_t (1, 0) : int64x64_t ();
cairo_x function declarations, which provide the fallback high precision arithmetic implementation.
int cairo_I _cairo_int128_lt(cairo_int128_t a, cairo_int128_t b)
cairo_uint128_t cairo_I _cairo_uint128_add(cairo_uint128_t a, cairo_uint128_t b)
#define _cairo_int128_add(a, b)
#define _cairo_int128_eq(a, b)
#define _cairo_int128_negative(a)
#define _cairo_int128_gt(a, b)
#define _cairo_int128_sub(a, b)
#define _cairo_int128_negate(a)
High precision numerical type, implementing Q64.64 fixed precision.
friend bool operator==(const int64x64_t &lhs, const int64x64_t &rhs)
Arithmetic operator.
static const uint64_t HP_MASK_LO
Mask for fraction part.
friend int64x64_t & operator*=(int64x64_t &lhs, const int64x64_t &rhs)
Compound multiplication operator.
int64_t GetInt(void) const
Truncate to an integer.
int64x64_t & operator=(const int64x64_t &o)
Assignment.
impl_type
Type tag for the underlying implementation.
@ int128_impl
Native int128_t implementation.
@ ld_impl
long double implementation.
@ cairo_impl
Cairo wideint implementation.
int64_t Round(void) const
Round to the nearest int.
void Mul(const int64x64_t &o)
Implement *=.
static uint128_t Udiv(const uint128_t a, const uint128_t b)
Unsigned division of Q64.64 values.
void MulByInvert(const int64x64_t &o)
Multiply this value by a Q0.128 value, presumably representing an inverse, completing a division oper...
friend bool operator<(const int64x64_t &lhs, const int64x64_t &rhs)
Less than operator.
friend int64x64_t & operator+=(int64x64_t &lhs, const int64x64_t &rhs)
Compound addition operator.
int64x64_t(const long double value)
Construct from a floating point value.
static uint128_t UmulByInvert(const uint128_t a, const uint128_t b)
Unsigned multiplication of Q64.64 and Q0.128 values.
static enum impl_type implementation
Type tag for this implementation.
friend int64x64_t operator!(const int64x64_t &lhs)
Logical not operator.
int128_t _v
The Q64.64 value.
cairo_int128_t _v
The Q64.64 value.
int64_t GetHigh(void) const
Get the integer portion.
int64x64_t(const int64_t hi, const uint64_t lo)
Construct from explicit high and low values.
void Div(const int64x64_t &o)
Implement /=.
uint64_t GetLow(void) const
Get the fractional portion of this value, unscaled.
static const uint64_t HPCAIRO_MASK_HI_BIT
High bit of fractional part.
int64x64_t(const unsigned long long int v)
Construct from an integral type.
int64x64_t(const unsigned int v)
Construct from an integral type.
int64x64_t(const long int v)
Construct from an integral type.
friend int64x64_t & operator-=(int64x64_t &lhs, const int64x64_t &rhs)
Compound subtraction operator.
int64x64_t(const long long int v)
Construct from an integral type.
int64x64_t(const unsigned long int v)
Construct from an integral type.
friend bool operator>(const int64x64_t &lhs, const int64x64_t &rhs)
Greater operator.
int64x64_t(const int v)
Construct from an integral type.
double GetDouble(void) const
Get this value as a double.
friend int64x64_t operator-(const int64x64_t &lhs)
Unary operator.
friend int64x64_t & operator/=(int64x64_t &lhs, const int64x64_t &rhs)
Compound division operator.
int64x64_t(const double value)
Construct from a floating point value.
int64x64_t(const int64x64_t &o)
Copy constructor.
int64x64_t()
Default constructor.
static uint128_t Umul(const uint128_t a, const uint128_t b)
Unsigned multiplication of Q64.64 values.
static int64x64_t Invert(const uint64_t v)
Compute the inverse of an integer value.
bool operator>(const int64x64_t &lhs, const int64x64_t &rhs)
Greater operator.
int64x64_t operator+(const int64x64_t &lhs)
Unary plus operator.
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.
int64x64_t operator!(const int64x64_t &lhs)
Logical not operator.
int64x64_t & operator*=(int64x64_t &lhs, const int64x64_t &rhs)
Compound multiplication operator.
int64x64_t & operator+=(int64x64_t &lhs, const int64x64_t &rhs)
Compound addition operator.
int64x64_t & operator-=(int64x64_t &lhs, const int64x64_t &rhs)
Compound subtraction operator.
#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.
bool operator==(const EventId &a, const EventId &b)
bool operator<(const EventId &a, const EventId &b)