introduced and used bigint datatype
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
gulliver
2022-12-05 23:39:56 +01:00
committed by gittiver
parent 0d3ffa0e5d
commit 87386e1b65
8 changed files with 341 additions and 132 deletions

27
src/big_int.hpp Normal file
View File

@ -0,0 +1,27 @@
#ifndef BIG_INT_HPP
#define BIG_INT_HPP
#include <string>
#include <array>
#include "tl/expected.hpp"
struct BigInt {
BigInt() : data() {}
virtual ~BigInt() {}
enum class eError : uint8_t { PARSE_ERROR };
static tl::expected<BigInt, eError> from_string(const std::string &str);
static BigInt from_int(uint64_t value);
std::string to_string() const;
friend bool operator == (const BigInt& rhs, const BigInt& lhs);
private:
std::array<uint8_t,256> data;
};
bool operator==(const BigInt &rhs, const BigInt &lhs);
#endif // #ifndef #ifndef BIG_INT_HPP