v0.14.0
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 287 of file clipper.cpp.

Constructor & Destructor Documentation

◆ Int128() [1/3]

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

Definition at line 293 of file clipper.cpp.

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

◆ Int128() [2/3]

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

Definition at line 300 of file clipper.cpp.

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

◆ Int128() [3/3]

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

Definition at line 302 of file clipper.cpp.

304 {

Member Function Documentation

◆ operator double()

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

Definition at line 375 of file clipper.cpp.

386 {

◆ operator!=()

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

Definition at line 314 of file clipper.cpp.

319  {

◆ operator+()

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

Definition at line 347 of file clipper.cpp.

355 {

◆ operator+=()

Int128& ClipperLib::Int128::operator+= ( const Int128 rhs)
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);

◆ operator-() [1/2]

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

Definition at line 367 of file clipper.cpp.

386 {

◆ operator-() [2/2]

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

Definition at line 360 of file clipper.cpp.

386 {

◆ operator-=()

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

Definition at line 354 of file clipper.cpp.

355 {
356  bool negate = (lhs < 0) != (rhs < 0);
357 
358  if (lhs < 0) lhs = -lhs;

◆ operator<()

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

Definition at line 325 of file clipper.cpp.

325  {
326  Int128 result(*this);
327  result -= rhs;
328  return result;
329  }
330 
331  Int128 operator-() const //unary negation

◆ operator<=()

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

Definition at line 336 of file clipper.cpp.

340  {

◆ operator=()

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

Definition at line 304 of file clipper.cpp.

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

◆ operator==()

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

Definition at line 311 of file clipper.cpp.

312  {

◆ operator>()

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

Definition at line 317 of file clipper.cpp.

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

◆ operator>=()

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

Definition at line 333 of file clipper.cpp.

340  {

Member Data Documentation

◆ hi

long64 ClipperLib::Int128::hi

Definition at line 291 of file clipper.cpp.

◆ lo

ulong64 ClipperLib::Int128::lo

Definition at line 290 of file clipper.cpp.


The documentation for this class was generated from the following file:
ClipperLib::Int128::lo
ulong64 lo
Definition: clipper.cpp:290
double
ClipperLib::Int128::operator-
Int128 operator-() const
Definition: clipper.cpp:367
ClipperLib::Int128::Int128
Int128(long64 _lo=0)
Definition: clipper.cpp:293
ClipperLib::Int128::hi
long64 hi
Definition: clipper.cpp:291