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=().

00018 {};

bigunsigned ( unsigned  n  )  [inline]

Definition at line 20 of file scalar_bigunsigned.hpp.

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

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


Member Function Documentation

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

Definition at line 124 of file scalar_bigunsigned.hpp.

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

00125   { 
00126     return *((const bigunsigned<N-1>*)(this->data+1)); 
00127   };

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().

00120   { 
00121     return *((bigunsigned<N-1>*)(this->data+1)); 
00122   };

bigunsigned& operator+= ( const bigunsigned< N > &  a  )  [inline]

Definition at line 135 of file scalar_bigunsigned.hpp.

References mmx::add().

00136   { 
00137     add(*this,a); 
00138     return *this;
00139   };

bigunsigned& operator+= ( unsigned  n  )  [inline]

Definition at line 129 of file scalar_bigunsigned.hpp.

References mmx::add().

00130   { 
00131     add(*this,n); 
00132     return *this; 
00133   };

bool operator< ( const bigunsigned< N > &  bi  )  [inline]

Definition at line 36 of file scalar_bigunsigned.hpp.

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

00037   {
00038     for ( int i = N-1; i >= 0; i ++ )
00039       if ( bi[i] > data[i] ) return true;
00040     return false;
00041   };

bigunsigned& operator<<= ( unsigned  n  )  [inline]

Definition at line 57 of file scalar_bigunsigned.hpp.

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

00058   {
00059     if ( n >= numerics::hdwi<hi>::nbit )
00060       {
00061         do
00062           {
00063             for ( unsigned i = N-1; i > 0; i -- )
00064               data[i]  = data[i-1];
00065             data[0] = 0;
00066             n -= numerics::hdwi<hi>::nbit;
00067           }
00068         while ( n >= numerics::hdwi<hi>::nbit );
00069       };
00070     if ( n )
00071       {
00072         data[N-1] <<= n;
00073         for ( int i = N-1; i > 0; i -- )
00074           {
00075             data[i] |= (data[i-1]>>(numerics::hdwi<hi>::nbit-n));
00076             data[i-1] <<= n;
00077           };
00078       };
00079     return *this;
00080   };

bigunsigned& operator= ( const bigunsigned< N > &  b  )  [inline]

Definition at line 31 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::bigunsigned().

00032   { 
00033     new (this) bigunsigned(b);  return *this;
00034   };

bigunsigned& operator= ( unsigned  n  )  [inline]

Definition at line 26 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::bigunsigned().

00027   { 
00028     new (this) bigunsigned(n); return *this;
00029   };

bool operator== ( const bigunsigned< N > &  bi  )  [inline]

Definition at line 50 of file scalar_bigunsigned.hpp.

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

00051   {
00052     for (unsigned i = 0; i < N; i ++ )
00053       if ( data[i] != bi[i] ) return false;
00054     return true;
00055   };

bool operator> ( const bigunsigned< N > &  bi  )  [inline]

Definition at line 43 of file scalar_bigunsigned.hpp.

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

00044   {
00045     for ( int i = N-1; i >= 0; i ++ )
00046       if ( bi[i] < data[i] ) return true;
00047     return false;
00048   };

bigunsigned& operator>>= ( unsigned  n  )  [inline]

Definition at line 82 of file scalar_bigunsigned.hpp.

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

00083   {
00084     if ( n >= numerics::hdwi<hi>::nbit )
00085       {
00086         do 
00087           {
00088             for ( unsigned i = 0; i < N-1; data[i] = data[i+1], i ++ ) ;
00089             data[N-1] = 0;
00090             n -= numerics::hdwi<hi>::nbit;
00091           }
00092         while ( n >= numerics::hdwi<hi>::nbit );
00093       };
00094     
00095     if ( n )
00096       {
00097         data[0] >>= n; 
00098         for ( int i = 0; i < int(N-1); i ++ )
00099           {
00100             data[i] |= (data[i+1]<<(numerics::hdwi<hi>::nbit-n));
00101             data[i+1] >>= n;
00102           };
00103       };
00104     return *this;
00105   };

unsigned operator[] ( int  i  )  const [inline]

Definition at line 146 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data.

00147   { 
00148     return data[i]; 
00149   };

unsigned& operator[] ( int  i  )  [inline]

Definition at line 141 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data.

00142   { 
00143     return data[i]; 
00144   };

bigunsigned& operator|= ( const bigunsigned< N > &  bu  )  [inline]

Definition at line 113 of file scalar_bigunsigned.hpp.

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

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

bigunsigned& operator|= ( unsigned  n  )  [inline]

Definition at line 107 of file scalar_bigunsigned.hpp.

References bigunsigned< N >::data.

00108   { 
00109     data[0] |= n; 
00110     return *this; 
00111   };


Member Data Documentation

hi data[N]
bool s_overflow = false [inline, static]

Definition at line 15 of file scalar_bigunsigned.hpp.


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

Generated on 6 Dec 2012 for realroot by  doxygen 1.6.1