SatCat5
satcat5::util::WideInteger< W > Struct Template Reference

Detailed Description

template<unsigned W>
struct satcat5::util::WideInteger< W >

Wide-integer parent class.

See also
wide_integer.h. Define the parent template for shared signed and unsigned functions. This class should not used directly; instead use WideSigned or WideUnsigned. The "W" parameter the is number of 32-bit subunits.

Definition at line 30 of file wide_integer.h.

#include <wide_integer.h>

Inheritance diagram for satcat5::util::WideInteger< W >:
[legend]

Public Member Functions

unsigned width_bits () const
 Total width in bits.
 
unsigned width_words () const
 Total width in 32-bit words.
 
unsigned msb () const
 Index of most significant '1' bit.
 
constexpr u32 sign_extend () const
 Extend most significant word with either "0" or "FFFF...".
 
void log_to (satcat5::log::LogBuffer &obj) const
 Human-readable logging in hexadecimal format.
 
bool read_from (satcat5::io::Readable *rd)
 Read binary data from a given source.
 
void write_to (satcat5::io::Writeable *wr) const
 Write binary data from a given sink.
 
template<unsigned W2>
 WideInteger (const satcat5::util::WideSigned< W2 > &rhs)
 Implicit size-converting copy constructors must know if the input is signed or unsigned to proceed.
 
template<unsigned W2>
 WideInteger (const satcat5::util::WideUnsigned< W2 > &rhs)
 Implicit size-converting copy constructors must know if the input is signed or unsigned to proceed.
 
WideInteger< W > & operator++ ()
 Increment/decrement.
 
WideInteger< W > & operator-- ()
 Increment/decrement.
 
WideInteger< W > operator++ (int)
 Increment/decrement.
 
WideInteger< W > operator-- (int)
 Increment/decrement.
 
bool operator== (const WideInteger< W > &rhs) const
 Equality comparison only. More...
 
bool operator!= (const WideInteger< W > &rhs) const
 Equality comparison only. More...
 
 operator bool () const
 Conversion to other basic types.
 
constexpr operator int32_t () const
 Conversion to other basic types.
 
constexpr operator int64_t () const
 Conversion to other basic types.
 
constexpr operator uint32_t () const
 Conversion to other basic types.
 
constexpr operator uint64_t () const
 Conversion to other basic types.
 

Public Attributes

u32 m_data [W]
 Underlying data vector, LSW-first.
 

Protected Member Functions

 WideInteger ()=default
 Constructors are private to force use of child classes. More...
 
constexpr WideInteger (u32 rhs)
 
constexpr WideInteger (u64 rhs)
 
constexpr WideInteger (u32 hi, u32 lo)
 
 WideInteger (s32 rhs)
 
 WideInteger (s64 rhs)
 
template<unsigned W2>
void copy_from (const satcat5::util::WideInteger< W2 > &rhs, u32 ext)
 
WideInteger< W > add (const WideInteger< W > &rhs) const
 
void add_in_place (const WideInteger< W > &rhs)
 
WideInteger< W > subtract (const WideInteger< W > &rhs) const
 
WideInteger< W > multiply (const WideInteger< W > &rhs) const
 
WideInteger< W > shift_left (unsigned rhs) const
 
WideInteger< W > shift_right (unsigned rhs, u32 ext) const
 
WideInteger< W > bitwise_invert () const
 
void bitwise_or (const WideInteger< W > &rhs)
 
void bitwise_and (const WideInteger< W > &rhs)
 
void bitwise_xor (const WideInteger< W > &rhs)
 

Static Protected Member Functions

template<typename T >
static constexpr u32 sign_extend (T x)
 

Constructor & Destructor Documentation

◆ WideInteger()

template<unsigned W>
satcat5::util::WideInteger< W >::WideInteger ( )
protecteddefault

Constructors are private to force use of child classes.

See also
wide_integer.h, util::WideSigned, util::WideUnsigned. Note: Nested templates are used to allow size conversion.

Member Function Documentation

◆ operator!=()

template<unsigned W>
bool satcat5::util::WideInteger< W >::operator!= ( const WideInteger< W > &  rhs) const
inline

Equality comparison only.

Greater-than and less-than require signed/unsigned specialization.

Definition at line 104 of file wide_integer.h.

◆ operator==()

template<unsigned W>
bool satcat5::util::WideInteger< W >::operator== ( const WideInteger< W > &  rhs) const
inline

Equality comparison only.

Greater-than and less-than require signed/unsigned specialization.

Definition at line 96 of file wide_integer.h.


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