GnuCash c935c2f+
Loading...
Searching...
No Matches
Functions
Constructors

Constructors are templated so that a GncInt128 can be constructed from any arbitrary integer type or pair of integer types. More...

Functions

 GncInt128::GncInt128 ()
 Default constructor.
 
template<typename T , std::enable_if_t< std::is_integral< T >::value, bool > = true>
 GncInt128::GncInt128 (T lower)
 
 GncInt128::GncInt128 (uint64_t lower)
 
template<typename T , typename U , std::enable_if_t<(std::is_integral< T >::value &&std::is_integral< U >::value), bool > = true>
 GncInt128::GncInt128 (T upper, U lower, unsigned char flags='\0')
 Double-integer constructor template.
 
 GncInt128::GncInt128 (int64_t upper, int64_t lower, unsigned char flags='\0')
 
template<typename T , std::enable_if_t< std::is_integral< T >::value, bool > = true>
 GncInt128::GncInt128 (T upper, uint64_t lower)
 
 GncInt128::GncInt128 (int64_t upper, uint64_t lower, unsigned char flags='\0')
 
 GncInt128::GncInt128 (uint64_t upper, uint64_t lower, unsigned char flags='\0')
 

Detailed Description

Constructors are templated so that a GncInt128 can be constructed from any arbitrary integer type or pair of integer types.

Note
If the two parameters are of differing sign, it's taken to mean that the lower magnitude is reducing the magnitude of the upper, so the lower magnitude will be subtracted from UINT64_MAX to obtain the lower limb value.

Function Documentation

◆ GncInt128() [1/5]

GncInt128::GncInt128 ( )

Default constructor.

Makes 0.

Definition at line 64 of file gnc-int128.cpp.

64: m_hi {0}, m_lo {0}{}

◆ GncInt128() [2/5]

template<typename T , std::enable_if_t< std::is_integral< T >::value, bool > = true>
GncInt128::GncInt128 ( lower)
inline

Definition at line 92 of file gnc-int128.hpp.

92 : GncInt128(INT64_C(0), static_cast<int64_t>(lower))
93 {}
GncInt128()
Default constructor.

◆ GncInt128() [3/5]

template<typename T , typename U , std::enable_if_t<(std::is_integral< T >::value &&std::is_integral< U >::value), bool > = true>
GncInt128::GncInt128 ( upper,
lower,
unsigned char  flags = '\0' 
)
inline

Double-integer constructor template.

Definition at line 100 of file gnc-int128.hpp.

100 :
101 GncInt128 {static_cast<int64_t>(upper),
102 static_cast<int64_t>(lower), flags} {}

◆ GncInt128() [4/5]

template<typename T , std::enable_if_t< std::is_integral< T >::value, bool > = true>
GncInt128::GncInt128 ( upper,
uint64_t  lower 
)
inline

Definition at line 107 of file gnc-int128.hpp.

107 :
108 GncInt128 {static_cast<int64_t>(upper), lower} {}

◆ GncInt128() [5/5]

GncInt128::GncInt128 ( uint64_t  lower)
inline

Definition at line 94 of file gnc-int128.hpp.

94: GncInt128 {UINT64_C(0), lower} {}