#include <int128.h>
|
| Int128 (const uint64_t &a, const int64_t &b) |
|
inet::Int128::Int128 |
( |
const Int128 & |
a | ) |
|
|
inline |
62 :
lo(a.lo),
hi(a.hi) {}
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
inet::Int128::Int128 |
( |
const uint32_t & |
a | ) |
|
|
inline |
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
inet::Int128::Int128 |
( |
const int32_t & |
a | ) |
|
|
inline |
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
inet::Int128::Int128 |
( |
const uint64_t & |
a | ) |
|
|
inline |
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
inet::Int128::Int128 |
( |
const int64_t & |
a | ) |
|
|
inline |
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
inet::Int128::Int128 |
( |
const float |
a | ) |
|
112 :
lo((uint64_t)fmodf(a, 18446744073709551616.0f)),
113 hi((int64_t)(a / 18446744073709551616.0f)) {}
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
inet::Int128::Int128 |
( |
const double & |
a | ) |
|
116 :
lo((uint64_t)fmod(a, 18446744073709551616.0)),
117 hi((int64_t)(a / 18446744073709551616.0)) {}
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
inet::Int128::Int128 |
( |
const long double & |
a | ) |
|
120 :
lo((uint64_t)fmodl(a, 18446744073709551616.0l)),
121 hi((int64_t)(a / 18446744073709551616.0l)) {}
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
inet::Int128::Int128 |
( |
const char * |
sz | ) |
|
|
inline |
inet::Int128::Int128 |
( |
const uint64_t & |
a, |
|
|
const int64_t & |
b |
|
) |
| |
|
inlineprivate |
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
value< double, units::m > b
Definition: Units.h:1054
bool inet::Int128::bit |
( |
unsigned int |
n | ) |
const |
Referenced by div().
297 return lo & (1ull << n);
299 return hi & (1ull << (n - 64));
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
void inet::Int128::bit |
( |
unsigned int |
n, |
|
|
bool |
val |
|
) |
| |
311 hi |= (1ull << (n - 64));
317 hi &= ~(1ull << (n - 64));
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Referenced by toString().
242 return 1u / (
unsigned int)divisor.lo;
246 Int128 ds = (divisor < 0) ? -divisor : divisor;
247 Int128 dd = (*
this < 0) ? -*
this : *
this;
259 unsigned int b = 127;
282 if ((divisor < 0) ^ (*
this < 0))
uint32_t ds
Definition: TCP_NSC.cc:76
Int128()
Definition: int128.h:61
value< double, units::m > b
Definition: Units.h:1054
inet::Int128::operator double |
( |
| ) |
|
|
inline |
double toDouble() const
Definition: int128.cc:129
inet::Int128::operator int |
( |
| ) |
|
|
inline |
int toInt() const
Definition: int128.h:147
bool inet::Int128::operator! |
( |
| ) |
const |
|
inline |
104 {
return !(
hi ||
lo); }
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128 div(const Int128 &, Int128 &) const
Definition: int128.cc:239
value< double, units::m > b
Definition: Units.h:1054
121 {
hi &=
b.hi;
lo &=
b.lo;
return *
this; }
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
value< double, units::m > b
Definition: Units.h:1054
229 for (
unsigned int i = 0; i < 128; ++i) {
Int128()
Definition: int128.h:61
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
value< double, units::m > b
Definition: Units.h:1054
const Int128& inet::Int128::operator+ |
( |
| ) |
const |
|
inline |
Int128 & inet::Int128::operator++ |
( |
| ) |
|
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128 inet::Int128::operator++ |
( |
int |
| ) |
|
Int128()
Definition: int128.h:61
value< double, units::m > b
Definition: Units.h:1054
206 uint64_t old_lo =
lo;
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
value< double, units::m > b
Definition: Units.h:1054
Int128 inet::Int128::operator- |
( |
| ) |
const |
Int128()
Definition: int128.h:61
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128 & inet::Int128::operator-- |
( |
| ) |
|
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128 inet::Int128::operator-- |
( |
int |
| ) |
|
Int128()
Definition: int128.h:61
value< double, units::m > b
Definition: Units.h:1054
130 return *
this += (-
b);
value< double, units::m > b
Definition: Units.h:1054
136 *
this = this->
div(
b, dummy);
Int128 div(const Int128 &, Int128 &) const
Definition: int128.cc:239
Int128()
Definition: int128.h:61
value< double, units::m > b
Definition: Units.h:1054
Int128 & inet::Int128::operator<<= |
( |
unsigned int |
n | ) |
|
370 uint64_t mask = ~((1ull << (64 - n)) - 1);
373 hi |= (
lo & mask) >> (64 - n);
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
85 {
lo = other.lo;
hi = other.hi;
return *
this; }
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128& inet::Int128::operator= |
( |
const int32_t & |
a | ) |
|
|
inline |
86 {
lo = a;
hi = 0;
return *
this; }
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128& inet::Int128::operator= |
( |
const uint32_t & |
a | ) |
|
|
inline |
87 {
lo = a;
hi = 0;
return *
this; }
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128& inet::Int128::operator= |
( |
const int64_t & |
a | ) |
|
|
inline |
89 {
lo = a;
hi = 0;
return *
this; }
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128& inet::Int128::operator= |
( |
const uint64_t & |
a | ) |
|
|
inline |
90 {
lo = a;
hi = 0;
return *
this; }
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128& inet::Int128::operator= |
( |
const char * |
sz | ) |
|
|
inline |
92 {
set(sz);
return *
this; }
Int128 & inet::Int128::operator= |
( |
const float & |
a | ) |
|
137 lo = ((uint64_t)fmodf(a, 18446744073709551616.0f));
138 hi = ((int64_t)(a / 18446744073709551616.0f));
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128 & inet::Int128::operator= |
( |
const double & |
a | ) |
|
144 lo = ((uint64_t)fmod(a, 18446744073709551616.0));
145 hi = ((int64_t)(a / 18446744073709551616.0));
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128 & inet::Int128::operator= |
( |
const long double & |
a | ) |
|
151 lo = ((uint64_t)fmodl(a, 18446744073709551616.0l));
152 hi = ((int64_t)(a / 18446744073709551616.0l));
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
Int128 & inet::Int128::operator>>= |
( |
unsigned int |
n | ) |
|
324 hi = (
hi < 0) ? -1ll : 0ll;
331 hi = (hi < 0) ? -1ll : 0ll;
340 uint64_t mask = (1ull << n) - 1;
343 lo |= (
hi & mask) << (64 - n);
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
122 {
hi ^=
b.hi;
lo ^=
b.lo;
return *
this; }
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
value< double, units::m > b
Definition: Units.h:1054
120 {
hi |=
b.hi;
lo |=
b.lo;
return *
this; }
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
value< double, units::m > b
Definition: Units.h:1054
Int128 inet::Int128::operator~ |
( |
| ) |
const |
|
inline |
Int128()
Definition: int128.h:61
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
void inet::Int128::set |
( |
const char * |
sz | ) |
|
92 for ( ; i < strlen(sz); ++i) {
94 if (sz[i] >=
'0' && sz[i] <=
'9' && sz[i] <
'0' + (
int)radix)
96 else if (sz[i] >=
'a' && sz[i] <=
'a' + (
int)radix - 10)
98 else if (sz[i] >=
'A' && sz[i] <=
'A' + (
int)radix - 10)
108 *
this =
Int128(0) - *
this;
Int128()
Definition: int128.h:61
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
double inet::Int128::toDouble |
( |
| ) |
const |
131 return (
double)
hi * 18446744073709551616.0
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
float inet::Int128::toFloat |
( |
| ) |
const |
125 return (
float)
hi * 18446744073709551616.0f
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
int inet::Int128::toInt |
( |
| ) |
const |
|
inline |
Referenced by toString().
uint64_t lo
Definition: int128.h:42
int64_t inet::Int128::toInt64 |
( |
| ) |
const |
|
inline |
148 {
return (int64_t)
lo; }
uint64_t lo
Definition: int128.h:42
long double inet::Int128::toLongDouble |
( |
| ) |
const |
158 return (
long double)
hi * 18446744073709551616.0l
int64_t hi
Definition: int128.h:43
uint64_t lo
Definition: int128.h:42
const char * inet::Int128::toString |
( |
uint32_t |
radix = 10 | ) |
const |
41 if (radix < 2 || radix > 37)
42 return "(invalid radix)";
48 Int128 ii = (*
this < 0) ? -*
this : *
this;
54 unsigned int c = r.toInt();
55 sz[--i] = c + ((c > 9) ?
'A' - 10 :
'0');
const value< double, compose< units::m, pow< units::s,-1 > > > c(299792458)
Int128()
Definition: int128.h:61
183 return (a.hi || a.lo) && (
b.hi ||
b.lo);
value< double, units::m > b
Definition: Units.h:1054
386 return (int64_t)a.lo < (int64_t)
b.lo;
value< double, units::m > b
Definition: Units.h:1054
178 return a.hi ==
b.hi && a.lo ==
b.lo;
value< double, units::m > b
Definition: Units.h:1054
188 return (a.hi || a.lo) || (
b.hi ||
b.lo);
value< double, units::m > b
Definition: Units.h:1054
Referenced by bit(), inet::operator&&(), operator&=(), operator*=(), operator++(), operator+=(), operator-(), operator--(), inet::operator<(), operator<<=(), operator=(), inet::operator==(), operator>>=(), operator^=(), operator|=(), inet::operator||(), set(), toDouble(), toFloat(), and toLongDouble().
const Int128 inet::Int128::INT128_MAX |
|
static |
const Int128 inet::Int128::INT128_MIN |
|
static |
uint64_t inet::Int128::lo |
|
private |
Referenced by bit(), div(), inet::operator&&(), operator&=(), operator*=(), operator++(), operator+=(), operator-(), operator--(), inet::operator<(), operator<<=(), operator=(), inet::operator==(), operator>>=(), operator^=(), operator|=(), inet::operator||(), set(), toDouble(), toFloat(), and toLongDouble().
The documentation for this class was generated from the following files: