v0.14.0
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ClipperLib::Int128 Class Reference
Collaboration diagram for ClipperLib::Int128:
[legend]

Public Member Functions

 Int128 (long64 _lo=0)
 
 Int128 (const Int128 &val)
 
 Int128 (const long64 &_hi, const ulong64 &_lo)
 
Int128operator= (const long64 &val)
 
bool operator== (const Int128 &val) const
 
bool operator!= (const Int128 &val) const
 
bool operator> (const Int128 &val) const
 
bool operator< (const Int128 &val) const
 
bool operator>= (const Int128 &val) const
 
bool operator<= (const Int128 &val) const
 
Int128operator+= (const Int128 &rhs)
 
Int128 operator+ (const Int128 &rhs) const
 
Int128operator-= (const Int128 &rhs)
 
Int128 operator- (const Int128 &rhs) const
 
Int128 operator- () const
 
 operator double () const
 

Public Attributes

ulong64 lo
 
long64 hi
 

Detailed Description

Definition at line 251 of file clipper.cpp.

Constructor & Destructor Documentation

◆ Int128() [1/3]

ClipperLib::Int128::Int128 ( long64  _lo = 0)
inline

Definition at line 257 of file clipper.cpp.

258 {
259 lo = (ulong64)_lo;
260 if (_lo < 0) hi = -1; else hi = 0;
261 }
unsigned long long ulong64
Definition: clipper.hpp:81

◆ Int128() [2/3]

ClipperLib::Int128::Int128 ( const Int128 val)
inline

Definition at line 264 of file clipper.cpp.

264: lo(val.lo), hi(val.hi){}

◆ Int128() [3/3]

ClipperLib::Int128::Int128 ( const long64 _hi,
const ulong64 _lo 
)
inline

Definition at line 266 of file clipper.cpp.

266: lo(_lo), hi(_hi){}

Member Function Documentation

◆ operator double()

ClipperLib::Int128::operator double ( ) const
inline

Definition at line 339 of file clipper.cpp.

340 {
341 const double shift64 = 18446744073709551616.0; //2^64
342 if (hi < 0)
343 {
344 if (lo == 0) return (double)hi * shift64;
345 else return -(double)(~lo + ~hi * shift64);
346 }
347 else
348 return (double)(lo + hi * shift64);
349 }

◆ operator!=()

bool ClipperLib::Int128::operator!= ( const Int128 val) const
inline

Definition at line 278 of file clipper.cpp.

279 { return !(*this == val);}

◆ operator+()

Int128 ClipperLib::Int128::operator+ ( const Int128 rhs) const
inline

Definition at line 311 of file clipper.cpp.

312 {
313 Int128 result(*this);
314 result+= rhs;
315 return result;
316 }
Int128(long64 _lo=0)
Definition: clipper.cpp:257

◆ operator+=()

Int128 & ClipperLib::Int128::operator+= ( const Int128 rhs)
inline

Definition at line 303 of file clipper.cpp.

304 {
305 hi += rhs.hi;
306 lo += rhs.lo;
307 if (lo < rhs.lo) hi++;
308 return *this;
309 }

◆ operator-() [1/2]

Int128 ClipperLib::Int128::operator- ( ) const
inline

Definition at line 331 of file clipper.cpp.

332 {
333 if (lo == 0)
334 return Int128(-hi, 0);
335 else
336 return Int128(~hi, ~lo + 1);
337 }

◆ operator-() [2/2]

Int128 ClipperLib::Int128::operator- ( const Int128 rhs) const
inline

Definition at line 324 of file clipper.cpp.

325 {
326 Int128 result(*this);
327 result -= rhs;
328 return result;
329 }

◆ operator-=()

Int128 & ClipperLib::Int128::operator-= ( const Int128 rhs)
inline

Definition at line 318 of file clipper.cpp.

319 {
320 *this += -rhs;
321 return *this;
322 }

◆ operator<()

bool ClipperLib::Int128::operator< ( const Int128 val) const
inline

Definition at line 289 of file clipper.cpp.

290 {
291 if (hi != val.hi)
292 return hi < val.hi;
293 else
294 return lo < val.lo;
295 }

◆ operator<=()

bool ClipperLib::Int128::operator<= ( const Int128 val) const
inline

Definition at line 300 of file clipper.cpp.

301 { return !(*this > val);}

◆ operator=()

Int128 & ClipperLib::Int128::operator= ( const long64 val)
inline

Definition at line 268 of file clipper.cpp.

269 {
270 lo = (ulong64)val;
271 if (val < 0) hi = -1; else hi = 0;
272 return *this;
273 }

◆ operator==()

bool ClipperLib::Int128::operator== ( const Int128 val) const
inline

Definition at line 275 of file clipper.cpp.

276 {return (hi == val.hi && lo == val.lo);}

◆ operator>()

bool ClipperLib::Int128::operator> ( const Int128 val) const
inline

Definition at line 281 of file clipper.cpp.

282 {
283 if (hi != val.hi)
284 return hi > val.hi;
285 else
286 return lo > val.lo;
287 }

◆ operator>=()

bool ClipperLib::Int128::operator>= ( const Int128 val) const
inline

Definition at line 297 of file clipper.cpp.

298 { return !(*this < val);}

Member Data Documentation

◆ hi

long64 ClipperLib::Int128::hi

Definition at line 255 of file clipper.cpp.

◆ lo

ulong64 ClipperLib::Int128::lo

Definition at line 254 of file clipper.cpp.


The documentation for this class was generated from the following file: