12 n = BN_bin2bn( (
const unsigned char*)bige,
l, NULL );
16 n = BN_bin2bn( (
const unsigned char*)bige.data(), bige.size(), NULL );
35 n = BN_bin2bn((
const unsigned char*)&big_endian_value,
sizeof(big_endian_value), NULL);
56 size_t size = BN_num_bytes(n);
58 BN_bn2bin(n, (
unsigned char*)&abs_value + (
sizeof(
uint64_t) - size));
59 return BN_is_negative(n) ? -(
int64_t)bswap_64(abs_value) : bswap_64(abs_value);
64 return BN_cmp( n, c.n ) < 0;
67 return BN_cmp( n, c.n ) > 0;
70 return BN_cmp( n, c.n ) >= 0;
73 return BN_cmp( n, c.n ) == 0;
76 return BN_cmp( n, c.n ) != 0;
78 bigint::operator bool()
const
80 return !BN_is_zero( n );
90 return *
this = *
this +
bigint(1);
100 return *
this = *
this -
bigint(1);
105 BN_add( tmp.n, n,
a.n );
110 BN_add( tmp.n, n,
a.n );
116 BN_sub( tmp.n, n,
a.n );
123 BN_CTX* ctx = BN_CTX_new();
125 BN_mul( tmp.n, n,
a.n, ctx );
130 BN_CTX* ctx = BN_CTX_new();
132 BN_div( tmp.n, NULL, n,
a.n, ctx );
137 BN_CTX* ctx = BN_CTX_new();
139 BN_mod( tmp.n, n,
a.n, ctx );
145 BN_CTX* ctx = BN_CTX_new();
147 BN_div( tmp.n, NULL, n,
a.n, ctx );
153 auto tmp = *
this *
a;
154 *
this = std::move(tmp);
160 BN_rshift( tmp.n, n, i );
170 BN_lshift( tmp.n, n, i );
177 BN_sub( tmp.n, n,
a.n );
182 BN_CTX* ctx = BN_CTX_new();
184 BN_exp( tmp.n, n,
a.n, ctx );
204 bigint::operator std::vector<char>()
const {
205 std::vector<char> to(BN_num_bytes(n));
206 BN_bn2bin(n,(
unsigned char*)to.data());
213 std::vector<char> ve = bi;
225 bi =
bigint(bin.c_str(), bin.size() );
bool operator>=(const bigint &c) const
bigint & operator=(const bigint &a)
bigint operator*(const bigint &a) const
bigint operator+(const bigint &a) const
bigint & operator<<=(uint32_t i)
bigint operator/(const bigint &a) const
bool operator==(const bigint &c) const
bool operator>(const bigint &c) const
bigint operator%(const bigint &a) const
bigint & operator+=(const bigint &a)
bigint exp(const bigint &c) const
bigint & operator-=(const bigint &a)
bool operator<(const bigint &c) const
bigint operator*=(const bigint &a)
bool operator!=(const bigint &c) const
bigint & operator>>=(uint32_t i)
bigint operator-(const bigint &a) const
bigint operator/=(const bigint &a)
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
uint64_t as_uint64() const
Defines exception's used by fc.
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
std::string base64_encode(unsigned char const *bytes_to_encode, unsigned int in_len)
void from_variant(const fc::variant &v, sysio::chain::chain_id_type &cid)
void to_variant(const sysio::chain::shared_public_key &var, fc::variant &vo)
std::string base64_decode(const std::string &encoded_string)
void swap(picojson::value &x, picojson::value &y)
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
unsigned __int64 uint64_t