amath  1.8.5
Simple command line calculator
BigInt Struct Reference

#include <bigint.h>

Public Member Functions

BigIntoperator= (const BigInt &rhs)
 
uint32_t GetLength () const
 
uint32_t Geboollock (uint32_t idx) const
 
void SetZero ()
 
bool IsZero () const
 
void SetUInt64 (uint64_t val)
 
void SetUInt32 (uint32_t val)
 
uint32_t GetUInt32 () const
 

Public Attributes

uint32_t m_length
 
uint32_t m_blocks [c_BigInt_MaxBlocks]
 

Detailed Description

Definition at line 61 of file bigint.h.

Member Function Documentation

◆ Geboollock()

uint32_t BigInt::Geboollock ( uint32_t  idx) const
inline

Definition at line 78 of file bigint.h.

References m_blocks.

Referenced by Dragon4().

78 { return m_blocks[idx]; }
uint32_t m_blocks[c_BigInt_MaxBlocks]
Definition: bigint.h:117
Here is the caller graph for this function:

◆ GetLength()

uint32_t BigInt::GetLength ( ) const
inline

Definition at line 77 of file bigint.h.

References m_length.

Referenced by Dragon4().

77 { return m_length; }
uint32_t m_length
Definition: bigint.h:116
Here is the caller graph for this function:

◆ GetUInt32()

uint32_t BigInt::GetUInt32 ( ) const
inline

Definition at line 114 of file bigint.h.

References m_blocks, and m_length.

114 { return (m_length == 0) ? 0 : m_blocks[0]; }
uint32_t m_blocks[c_BigInt_MaxBlocks]
Definition: bigint.h:117
uint32_t m_length
Definition: bigint.h:116

◆ IsZero()

bool BigInt::IsZero ( ) const
inline

Definition at line 80 of file bigint.h.

References m_length.

Referenced by Dragon4().

80 { return m_length == 0; }
uint32_t m_length
Definition: bigint.h:116
Here is the caller graph for this function:

◆ operator=()

BigInt& BigInt::operator= ( const BigInt rhs)
inline

Definition at line 63 of file bigint.h.

References m_blocks, and m_length.

Referenced by BigInt_MultiplyPow10(), BigInt_Pow10(), and Dragon4().

64  {
65  uint32_t length = rhs.m_length;
66  uint32_t *pLhsCur = m_blocks;
67  for (const uint32_t *pRhsCur = rhs.m_blocks, *pRhsEnd = pRhsCur + length;
68  pRhsCur != pRhsEnd;
69  ++pLhsCur, ++pRhsCur)
70  {
71  *pLhsCur = *pRhsCur;
72  }
73  m_length = length;
74  return *this;
75  }
uint32_t m_blocks[c_BigInt_MaxBlocks]
Definition: bigint.h:117
uint32_t m_length
Definition: bigint.h:116
Here is the caller graph for this function:

◆ SetUInt32()

void BigInt::SetUInt32 ( uint32_t  val)
inline

Definition at line 101 of file bigint.h.

References m_blocks, and m_length.

Referenced by BigInt_Pow10(), and Dragon4().

102  {
103  if (val != 0)
104  {
105  m_blocks[0] = val;
106  m_length = (val != 0);
107  }
108  else
109  {
110  m_length = 0;
111  }
112  }
uint32_t m_blocks[c_BigInt_MaxBlocks]
Definition: bigint.h:117
uint32_t m_length
Definition: bigint.h:116
Here is the caller graph for this function:

◆ SetUInt64()

void BigInt::SetUInt64 ( uint64_t  val)
inline

Definition at line 82 of file bigint.h.

References m_blocks, and m_length.

Referenced by Dragon4().

83  {
84  if (val > 0xFFFFFFFF)
85  {
86  m_blocks[0] = val & 0xFFFFFFFF;
87  m_blocks[1] = (val >> 32) & 0xFFFFFFFF;
88  m_length = 2;
89  }
90  else if (val != 0)
91  {
92  m_blocks[0] = val & 0xFFFFFFFF;
93  m_length = 1;
94  }
95  else
96  {
97  m_length = 0;
98  }
99  }
uint32_t m_blocks[c_BigInt_MaxBlocks]
Definition: bigint.h:117
uint32_t m_length
Definition: bigint.h:116
Here is the caller graph for this function:

◆ SetZero()

void BigInt::SetZero ( )
inline

Definition at line 79 of file bigint.h.

References m_length.

79 { m_length = 0; }
uint32_t m_length
Definition: bigint.h:116

Member Data Documentation

◆ m_blocks

◆ m_length


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