realroot_doc 0.1.1
bigunsigned< N > Struct Template Reference

#include <scalar_bigunsigned.hpp>

List of all members.

Public Types

Public Member Functions

Public Attributes

Static Public Attributes


Detailed Description

template<unsigned N>
struct mmx::bigunsigned< N >

Definition at line 11 of file scalar_bigunsigned.hpp.


Member Typedef Documentation

typedef unsigned hdwi_t

Definition at line 14 of file scalar_bigunsigned.hpp.

typedef unsigned hi

Definition at line 13 of file scalar_bigunsigned.hpp.


Constructor & Destructor Documentation

bigunsigned ( ) [inline]

Definition at line 18 of file scalar_bigunsigned.hpp.

Referenced by bigunsigned< N >::operator=().

{};
bigunsigned ( unsigned  n) [inline]

Definition at line 20 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data, and mmx::N().

  {
    data[0] = n;
    for (unsigned  i = 1; i < N; data[i] = 0, i ++ ) ;
  };

Member Function Documentation

bigunsigned<N-1>& next ( ) [inline]

Definition at line 119 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data, and mmx::N().

Referenced by mmx::add().

  { 
    return *((bigunsigned<N-1>*)(this->data+1)); 
  };
const bigunsigned<N-1>& next ( ) const [inline]

Definition at line 124 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data, and mmx::N().

  { 
    return *((const bigunsigned<N-1>*)(this->data+1)); 
  };
bigunsigned& operator+= ( unsigned  n) [inline]

Definition at line 129 of file scalar_bigunsigned.hpp.

References mmx::add().

  { 
    add(*this,n); 
    return *this; 
  };
bigunsigned& operator+= ( const bigunsigned< N > &  a) [inline]

Definition at line 135 of file scalar_bigunsigned.hpp.

References mmx::add().

  { 
    add(*this,a); 
    return *this;
  };
bool operator< ( const bigunsigned< N > &  bi) [inline]

Definition at line 36 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data, and mmx::N().

  {
    for ( int i = N-1; i >= 0; i ++ )
      if ( bi[i] > data[i] ) return true;
    return false;
  };
bigunsigned& operator<<= ( unsigned  n) [inline]

Definition at line 57 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data, and mmx::N().

  {
    if ( n >= numerics::hdwi<hi>::nbit )
      {
        do
          {
            for ( unsigned i = N-1; i > 0; i -- )
              data[i]  = data[i-1];
            data[0] = 0;
            n -= numerics::hdwi<hi>::nbit;
          }
        while ( n >= numerics::hdwi<hi>::nbit );
      };
    if ( n )
      {
        data[N-1] <<= n;
        for ( int i = N-1; i > 0; i -- )
          {
            data[i] |= (data[i-1]>>(numerics::hdwi<hi>::nbit-n));
            data[i-1] <<= n;
          };
      };
    return *this;
  };
bigunsigned& operator= ( const bigunsigned< N > &  b) [inline]

Definition at line 31 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::bigunsigned().

  { 
    new (this) bigunsigned(b);  return *this;
  };
bigunsigned& operator= ( unsigned  n) [inline]

Definition at line 26 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::bigunsigned().

  { 
    new (this) bigunsigned(n); return *this;
  };
bool operator== ( const bigunsigned< N > &  bi) [inline]

Definition at line 50 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data, and mmx::N().

  {
    for (unsigned i = 0; i < N; i ++ )
      if ( data[i] != bi[i] ) return false;
    return true;
  };
bool operator> ( const bigunsigned< N > &  bi) [inline]

Definition at line 43 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data, and mmx::N().

  {
    for ( int i = N-1; i >= 0; i ++ )
      if ( bi[i] < data[i] ) return true;
    return false;
  };
bigunsigned& operator>>= ( unsigned  n) [inline]

Definition at line 82 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data, and mmx::N().

  {
    if ( n >= numerics::hdwi<hi>::nbit )
      {
        do 
          {
            for ( unsigned i = 0; i < N-1; data[i] = data[i+1], i ++ ) ;
            data[N-1] = 0;
            n -= numerics::hdwi<hi>::nbit;
          }
        while ( n >= numerics::hdwi<hi>::nbit );
      };
    
    if ( n )
      {
        data[0] >>= n; 
        for ( int i = 0; i < int(N-1); i ++ )
          {
            data[i] |= (data[i+1]<<(numerics::hdwi<hi>::nbit-n));
            data[i+1] >>= n;
          };
      };
    return *this;
  };
unsigned& operator[] ( int  i) [inline]

Definition at line 141 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data.

  { 
    return data[i]; 
  };
unsigned operator[] ( int  i) const [inline]

Definition at line 146 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data.

  { 
    return data[i]; 
  };
bigunsigned& operator|= ( unsigned  n) [inline]

Definition at line 107 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data.

  { 
    data[0] |= n; 
    return *this; 
  };
bigunsigned& operator|= ( const bigunsigned< N > &  bu) [inline]

Definition at line 113 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data, and mmx::N().

  {
    for ( unsigned i = 0; i < N; data[i] |= bu[i], i ++ ) ;
    return *this;
  };

Member Data Documentation

bool s_overflow = false [static]

Definition at line 15 of file scalar_bigunsigned.hpp.


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