1 #include "ns3/core-config.h"
2 #if !defined(INT64X64_CAIRO_H) && defined (INT64X64_USE_CAIRO) && !defined(PYTHON_SCAN)
3 #define INT64X64_CAIRO_H
19 static const uint64_t HPCAIRO_MASK_HI_BIT = (((uint64_t)1)<<63);
21 static const uint64_t
HP_MASK_LO = 0xffffffffffffffffULL;
34 #define HP_MAX_64 (std::pow (2.0L, 64))
72 const bool negative = value < 0;
73 const long double v = negative ? -value : value;
76 long double flo = std::modf (v, &fhi);
85 const long double round = 0.5;
131 inline int64x64_t (
const unsigned long long int v)
143 explicit inline int64x64_t (
const int64_t hi,
const uint64_t lo)
176 const long double fhi = value.
hi;
178 long double retval = fhi;
180 retval = negative ? -retval : retval;
188 inline int64_t
GetHigh (
void)
const
190 return (int64_t)
_v.hi;
197 inline uint64_t
GetLow (
void)
const
277 static cairo_uint128_t
Umul (
const cairo_uint128_t a,
const cairo_uint128_t b);
285 static cairo_uint128_t
Udiv (
const cairo_uint128_t a,
const cairo_uint128_t b);
295 static cairo_uint128_t
UmulByInvert (
const cairo_uint128_t a,
const cairo_uint128_t b);
306 inline bool operator == (
const int64x64_t & lhs,
const int64x64_t & rhs)
314 inline bool operator < (
const int64x64_t & lhs,
const int64x64_t & rhs)
322 inline bool operator > (
const int64x64_t & lhs,
const int64x64_t & rhs)
331 inline int64x64_t &
operator += (int64x64_t & lhs,
const int64x64_t & rhs)
340 inline int64x64_t &
operator -= (int64x64_t & lhs,
const int64x64_t & rhs)
349 inline int64x64_t &
operator *= (int64x64_t & lhs,
const int64x64_t & rhs)
358 inline int64x64_t &
operator /= (int64x64_t & lhs,
const int64x64_t & rhs)
368 inline int64x64_t
operator + (
const int64x64_t & lhs)
376 inline int64x64_t
operator - (
const int64x64_t & lhs)
378 int64x64_t tmp = lhs;
386 inline int64x64_t
operator ! (
const int64x64_t & lhs)
388 return (lhs == int64x64_t ()) ? int64x64_t (1, 0) : int64x64_t ();
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 uint128_t Udiv(const uint128_t a, const uint128_t b)
Unsigned division of Q64.64 values.
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...
static uint128_t UmulByInvert(const uint128_t a, const uint128_t b)
Unsigned multiplication of Q64.64 and Q0.128 values.
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.
int I _cairo_int128_lt(cairo_int128_t a, cairo_int128_t b)
friend int64x64_t & operator/=(int64x64_t &lhs, const int64x64_t &rhs)
Compound division operator.
static uint128_t Umul(const uint128_t a, const uint128_t b)
Unsigned multiplication of Q64.64 values.
int128_t _v
The Q64.64 value.
friend int64x64_t & operator-=(int64x64_t &lhs, const int64x64_t &rhs)
Compound subtraction operator.
#define _cairo_int128_eq(a, b)
void Mul(const int64x64_t &o)
Implement *=.
int64x64_t()
Default constructor.
bool operator<(const int64x64_t &lhs, const int64x64_t &rhs)
Less than operator.
#define _cairo_int128_sub(a, b)
int64x64_t & operator*=(int64x64_t &lhs, const int64x64_t &rhs)
Compound multiplication operator.
#define _cairo_int128_negative(a)
#define _cairo_int128_gt(a, b)
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:
void Div(const int64x64_t &o)
Implement /=.
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)
#define _cairo_int128_negate(a)
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.
#define _cairo_int128_add(a, b)
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.