CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Math::LargeInteger< Hi, Low > Struct Template Referencefinal

A wide integer type that uses Hi for the high-order bits in the integer data and Lo for the low-order bits. More...

#include <CeresEngine/Math/LargeInteger.hpp>

Public Types

using Self = LargeInteger< Hi, Low >
 The large integer type itself.
 

Public Member Functions

constexpr LargeInteger () noexcept=default
 Creates a new LargeInteger initialized to the value of 0.
 
constexpr LargeInteger (const LargeInteger &) noexcept=default
 Creates a new LargeInteger by copying the contents of another.
 
LargeIntegeroperator= (const LargeInteger &) noexcept=default
 Assigns the LargeInteger by copying the contents of another.
 
constexpr LargeInteger (LargeInteger &&) noexcept=default
 Creates a new LargeInteger by moving the contents of another.
 
LargeIntegeroperator= (LargeInteger &&) noexcept=default
 Assigns the LargeInteger by moving the contents of another.
 
template<typename THi >
constexpr LargeInteger (LargeInteger< THi, Low > value) noexcept
 Creates a new LargeInteger by converting the Hi representation type.
 
template<typename Tp , typename = std::enable_if_t<std::is_integral_v<Tp>>>
constexpr LargeInteger (Tp value) noexcept
 Creates a new LargeInteger by converting from the native integer value.
 
template<typename Tp , typename = std::enable_if_t<std::is_integral_v<Tp>>>
constexpr operator Tp () const noexcept
 Converts the LargeInteger into a native integer format.
 
constexpr LargeInteger (float value) noexcept
 Creates a new LargeInteger by converting from the floating point value.
 
constexpr operator float () const noexcept
 Converts the LargeInteger into a floating point value.
 
constexpr LargeInteger (double value) noexcept
 Creates a new LargeInteger by converting from the floating point value.
 
constexpr operator double () const noexcept
 Converts the LargeInteger into a floating point value.
 
constexpr LargeInteger (long double value) noexcept
 Creates a new LargeInteger by converting from the floating point value.
 
constexpr operator long double () const noexcept
 Converts the LargeInteger into a floating point value.
 
constexpr operator bool () const noexcept
 A overloaded bool operator that checks if any of the bits in the large integer are set to non-zero.
 

Friends

template<typename , typename >
struct LargeInteger
 

Detailed Description

template<typename Hi, typename Low = typename std::make_unsigned<Hi>::type>
struct Math::LargeInteger< Hi, Low >

A wide integer type that uses Hi for the high-order bits in the integer data and Lo for the low-order bits.

Template Parameters
Hithe large integer higher-order bits type
Lowthe large integer lower-order bits type. By default, this is set to the unsigned form of Hi by using the helper class std::make_unsigned<Hi>.

Member Typedef Documentation

◆ Self

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
using Math::LargeInteger< Hi, Low >::Self = LargeInteger<Hi, Low>

The large integer type itself.

Used to avoid automatic template deduction on operator arguments.

Constructor & Destructor Documentation

◆ LargeInteger() [1/8]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::LargeInteger ( )
constexprdefaultnoexcept

Creates a new LargeInteger initialized to the value of 0.

◆ LargeInteger() [2/8]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::LargeInteger ( const LargeInteger< Hi, Low > &  )
constexprdefaultnoexcept

Creates a new LargeInteger by copying the contents of another.

◆ LargeInteger() [3/8]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::LargeInteger ( LargeInteger< Hi, Low > &&  )
constexprdefaultnoexcept

Creates a new LargeInteger by moving the contents of another.

◆ LargeInteger() [4/8]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
template<typename THi >
constexpr Math::LargeInteger< Hi, Low >::LargeInteger ( LargeInteger< THi, Low >  value)
inlineexplicitconstexprnoexcept

Creates a new LargeInteger by converting the Hi representation type.

Template Parameters
THithe old Hi type to convert from
Parameters
valueThe large integer value

◆ LargeInteger() [5/8]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
template<typename Tp , typename = std::enable_if_t<std::is_integral_v<Tp>>>
constexpr Math::LargeInteger< Hi, Low >::LargeInteger ( Tp  value)
inlineconstexprnoexcept

Creates a new LargeInteger by converting from the native integer value.

Parameters
valueThe native integer to convert from

◆ LargeInteger() [6/8]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::LargeInteger ( float  value)
inlineconstexprnoexcept

Creates a new LargeInteger by converting from the floating point value.

Parameters
valueThe floating point value to convert from

◆ LargeInteger() [7/8]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::LargeInteger ( double  value)
inlineconstexprnoexcept

Creates a new LargeInteger by converting from the floating point value.

Parameters
valueThe floating point value to convert from

◆ LargeInteger() [8/8]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::LargeInteger ( long double  value)
inlineconstexprnoexcept

Creates a new LargeInteger by converting from the floating point value.

Parameters
valueThe floating point value to convert from

Member Function Documentation

◆ operator bool()

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::operator bool ( ) const
inlineexplicitconstexprnoexcept

A overloaded bool operator that checks if any of the bits in the large integer are set to non-zero.

Returns
true if the integer is different than 0.

◆ operator double()

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::operator double ( ) const
inlineexplicitconstexprnoexcept

Converts the LargeInteger into a floating point value.

Returns
The converted floating point value

◆ operator float()

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::operator float ( ) const
inlineexplicitconstexprnoexcept

Converts the LargeInteger into a floating point value.

Returns
The converted floating point value

◆ operator long double()

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
constexpr Math::LargeInteger< Hi, Low >::operator long double ( ) const
inlineexplicitconstexprnoexcept

Converts the LargeInteger into a floating point value.

Returns
The converted floating point value

◆ operator Tp()

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
template<typename Tp , typename = std::enable_if_t<std::is_integral_v<Tp>>>
constexpr Math::LargeInteger< Hi, Low >::operator Tp ( ) const
inlineexplicitconstexprnoexcept

Converts the LargeInteger into a native integer format.

Any higher-order bits that cannot fit in the requested type are discarded.

Returns
The converted integer value

◆ operator=() [1/2]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
LargeInteger & Math::LargeInteger< Hi, Low >::operator= ( const LargeInteger< Hi, Low > &  )
defaultnoexcept

Assigns the LargeInteger by copying the contents of another.

Returns
*this

◆ operator=() [2/2]

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
LargeInteger & Math::LargeInteger< Hi, Low >::operator= ( LargeInteger< Hi, Low > &&  )
defaultnoexcept

Assigns the LargeInteger by moving the contents of another.

Returns
*this

Friends And Related Symbol Documentation

◆ LargeInteger

template<typename Hi , typename Low = typename std::make_unsigned<Hi>::type>
template<typename , typename >
friend struct LargeInteger
friend

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