18#if defined(INT64X64_USE_CAIRO) && !defined(PYTHON_SCAN)
63 return (negA && !negB) || (!negA && negB);
71 cairo_uint128_t result =
Umul(a, b);
78 cairo_uint128_t result;
79 cairo_uint128_t hiPart, loPart, midPart;
80 cairo_uint128_t res1, res2;
94 "High precision 128 bits multiplication error: multiplication overflow.");
114 cairo_uint128_t a, b;
116 cairo_uint128_t result =
Udiv(a, b);
123 cairo_uint128_t den = b;
125 cairo_uint128_t result = qr.
quo;
126 cairo_uint128_t rem = qr.
rem;
129 const uint64_t DIGITS = 64;
138 while ((shift < DIGITS) && !(den.lo & 0x1))
157 while ((digis + shift < DIGITS) && (!(den.lo & 0x1) ||
_cairo_uint128_lt(rem, den)))
176 shift = DIGITS - digis;
196 cairo_uint128_t result;
197 cairo_uint128_t hi, mid;
211 cairo_uint128_t a, factor;
217 result.
_v =
Udiv(a, factor);
222 cairo_uint128_t one = {1, 0};
NS_ABORT_x macro definitions.
NS_ASSERT() and NS_ASSERT_MSG() macro definitions.
cairo_uint128_t cairo_I _cairo_uint128_negate(cairo_uint128_t a)
int cairo_I _cairo_uint128_eq(cairo_uint128_t a, cairo_uint128_t b)
cairo_uint128_t cairo_I _cairo_uint128_add(cairo_uint128_t a, cairo_uint128_t b)
#define _cairo_int128_lsl(a, b)
#define _cairo_int128_to_uint128(i)
cairo_uint128_t cairo_I _cairo_uint32_to_uint128(uint32_t i)
cairo_uint128_t cairo_I _cairo_uint64x64_128_mul(cairo_uint64_t a, cairo_uint64_t b)
cairo_uint128_t cairo_I _cairo_uint128_lsl(cairo_uint128_t a, int shift)
#define _cairo_int128_negative(a)
cairo_uint128_t cairo_I _cairo_uint128_rsl(cairo_uint128_t a, int shift)
int cairo_I _cairo_uint128_lt(cairo_uint128_t a, cairo_uint128_t b)
cairo_uquorem128_t cairo_I _cairo_uint128_divrem(cairo_uint128_t num, cairo_uint128_t den)
#define _cairo_int128_negate(a)
cairo_uint128_t cairo_I _cairo_uint64_to_uint128(cairo_uint64_t i)
Implementation of the cairo_x functions which implement high precision arithmetic.
High precision numerical type, implementing Q64.64 fixed precision.
int64_t GetHigh() const
Get the integer portion.
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...
static uint128_t UmulByInvert(const uint128_t a, const uint128_t b)
Unsigned multiplication of Q64.64 and Q0.128 values.
int128_t _v
The Q64.64 value.
void Div(const int64x64_t &o)
Implement /=.
static const uint64_t HPCAIRO_MASK_HI_BIT
High bit of fractional part.
static int64x64_t Invert(const uint64_t v)
Compute the inverse of an integer value.
int64x64_t()
Default constructor.
static uint128_t Umul(const uint128_t a, const uint128_t b)
Unsigned multiplication of Q64.64 values.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
static bool output_sign(const int128_t sa, const int128_t sb, uint128_t &ua, uint128_t &ub)
Compute the sign of the result of multiplying or dividing Q64.64 fixed precision operands.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Using the ns3::int64x64_t based on Cairo 128-bit integers.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::TestCase, ns3::TestSuite, ns3::TestRunner declarations, and NS_TEST_ASSERT macro definitions.