Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
libff::bigint< n > Class Template Reference

#include <bigint.hpp>

Public Member Functions

 bigint ()=default
 
 bigint (const unsigned long x)
 
 bigint (const char *s)
 Initalize from a small integer.
 
 bigint (const mpz_t r)
 Initialize from a string containing an integer in decimal notation.
 
void print () const
 Initialize from MPZ element.
 
void print_hex () const
 
bool operator== (const bigint< n > &other) const
 
bool operator!= (const bigint< n > &other) const
 
void clear ()
 
bool is_zero () const
 
size_t max_bits () const
 
size_t num_bits () const
 Returns the number of bits representable by this bigint type.
 
unsigned long as_ulong () const
 Returns the number of bits in this specific bigint value, i.e., position of the most-significant 1.
 
void to_mpz (mpz_t r) const
 Return the last limb of the integer.
 
bool test_bit (const std::size_t bitno) const
 
bigintrandomize ()
 

Public Attributes

mp_limb_t data [n] = {0}
 

Static Public Attributes

static const mp_size_t N = n
 

Friends

std::ostream & operator<< (std::ostream &out, const bigint< n > &b)
 
std::istream & operator>> (std::istream &in, bigint< n > &b)
 

Detailed Description

template<mp_size_t n>
class libff::bigint< n >

Wrapper class around GMP's MPZ long integers. It supports arithmetic operations, serialization and randomization. Serialization is fragile, see common/serialization.hpp.

Definition at line 31 of file bigint.hpp.

Constructor & Destructor Documentation

◆ bigint() [1/4]

template<mp_size_t n>
libff::bigint< n >::bigint ( )
default

◆ bigint() [2/4]

template<mp_size_t n>
libff::bigint< n >::bigint ( const unsigned long x)

◆ bigint() [3/4]

template<mp_size_t n>
libff::bigint< n >::bigint ( const char * s)

◆ bigint() [4/4]

template<mp_size_t n>
libff::bigint< n >::bigint ( const mpz_t r)

Member Function Documentation

◆ as_ulong()

template<mp_size_t n>
unsigned long libff::bigint< n >::as_ulong ( ) const

◆ clear()

template<mp_size_t n>
void libff::bigint< n >::clear ( )

◆ is_zero()

template<mp_size_t n>
bool libff::bigint< n >::is_zero ( ) const

◆ max_bits()

template<mp_size_t n>
size_t libff::bigint< n >::max_bits ( ) const
inline

Definition at line 48 of file bigint.hpp.

48{ return n * GMP_NUMB_BITS; }
Here is the caller graph for this function:

◆ num_bits()

template<mp_size_t n>
size_t libff::bigint< n >::num_bits ( ) const

◆ operator!=()

template<mp_size_t n>
bool libff::bigint< n >::operator!= ( const bigint< n > & other) const

◆ operator==()

template<mp_size_t n>
bool libff::bigint< n >::operator== ( const bigint< n > & other) const

◆ print()

template<mp_size_t n>
void libff::bigint< n >::print ( ) const

◆ print_hex()

template<mp_size_t n>
void libff::bigint< n >::print_hex ( ) const

◆ randomize()

template<mp_size_t n>
bigint & libff::bigint< n >::randomize ( )

◆ test_bit()

template<mp_size_t n>
bool libff::bigint< n >::test_bit ( const std::size_t bitno) const
Here is the caller graph for this function:

◆ to_mpz()

template<mp_size_t n>
void libff::bigint< n >::to_mpz ( mpz_t r) const

Friends And Related Symbol Documentation

◆ operator<<

template<mp_size_t n>
std::ostream & operator<< ( std::ostream & out,
const bigint< n > & b )
friend

◆ operator>>

template<mp_size_t n>
std::istream & operator>> ( std::istream & in,
bigint< n > & b )
friend

Member Data Documentation

◆ data

template<mp_size_t n>
mp_limb_t libff::bigint< n >::data[n] = {0}

Definition at line 35 of file bigint.hpp.

35{0};

◆ N

template<mp_size_t n>
const mp_size_t libff::bigint< n >::N = n
static

Definition at line 33 of file bigint.hpp.


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