STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Static Public Member Functions | Static Public Attributes | List of all members
_Swc_traits< _Ty, _Mx, _Nw > Struct Template Reference

Public Types

typedef int _Cy_t
 
typedef _Ty _Mod_t
 
typedef _Ty _Seed_t
 

Static Public Member Functions

static int _Get_wc ()
 
template<class _Gen >
static _Cy_t _Reset (_Gen &_Gx, _Ty *_Ax, bool _Readcy)
 
static _Cy_t _Reduce (_Ty *_Ax)
 
template<class _Elem , class _Traits >
static void _Write (basic_ostream< _Elem, _Traits > &_Ostr, const _Circ_buf< _Ty, _Nw > &_Buf, _Cy_t _Cy)
 

Static Public Attributes

static const _Cy_t _Cy = 1
 
static const _Mod_t _Mod = _Mx
 
static const _Ty _Max = _Mx - 1
 

Member Typedef Documentation

template<class _Ty, _Ty _Mx, size_t _Nw>
typedef int _Swc_traits< _Ty, _Mx, _Nw >::_Cy_t
template<class _Ty, _Ty _Mx, size_t _Nw>
typedef _Ty _Swc_traits< _Ty, _Mx, _Nw >::_Mod_t
template<class _Ty, _Ty _Mx, size_t _Nw>
typedef _Ty _Swc_traits< _Ty, _Mx, _Nw >::_Seed_t

Member Function Documentation

template<class _Ty, _Ty _Mx, size_t _Nw>
static int _Swc_traits< _Ty, _Mx, _Nw >::_Get_wc ( )
inlinestatic
983  { // compute number of 32-bit words per element
984  int _Kx;
985 
986  if (_Mx == 0)
987  _Kx = (_BITS_BYTE * sizeof (_Ty) + 31) / 32;
988  else
989  { // compute number of 32-bit words required
990  _ULonglong _Val = (_ULonglong)1 << 32;
991  for (_Kx = 1; 0 < _Val && _Val < _Mx; ++_Kx)
992  _Val = _Val << 32;
993  }
994  return (_Kx);
995  }
#define _BITS_BYTE
Definition: random:19
_FwdIt const _Ty _Val
Definition: algorithm:1938
_ULONGLONG _ULonglong
Definition: yvals.h:587
template<class _Ty, _Ty _Mx, size_t _Nw>
static _Cy_t _Swc_traits< _Ty, _Mx, _Nw >::_Reduce ( _Ty *  _Ax)
inlinestatic
1019  { // reduce values to allowed range
1020  if (_Mx != 0)
1021  for (int _Ix = 0; _Ix < _Nw; ++_Ix)
1022  _Ax[_Ix] = _Ax[_Ix] % _Mx;
1023  return (_Ax[_Nw - 1] == 0);
1024  }
template<class _Ty, _Ty _Mx, size_t _Nw>
template<class _Gen >
static _Cy_t _Swc_traits< _Ty, _Mx, _Nw >::_Reset ( _Gen &  _Gx,
_Ty *  _Ax,
bool  _Readcy 
)
inlinestatic
999  { // set initial values of _Ax from generator _Gx
1000  // return value of _Cy from range if _Readcy is true,
1001  // otherwise compute from last value
1002  int _Kx = _Get_wc();
1003 
1004  for (int _Ix = 0; _Ix < _Nw; ++_Ix)
1005  { // pack _Kx words
1006  _Ax[_Ix] = _Gx();
1007  for (int _Jx = 0; ++_Jx < _Kx; )
1008  _Ax[_Ix] |= (_Ty)_Gx() << (32 * _Jx);
1009  }
1010 
1011  _Cy_t _Ans = _Reduce(_Ax);
1012  if (!_Readcy)
1013  return (_Ans);
1014  else
1015  return (_Gx());
1016  }
static _Cy_t _Reduce(_Ty *_Ax)
Definition: random:1018
int _Cy_t
Definition: random:974
static int _Get_wc()
Definition: random:982
template<class _Ty, _Ty _Mx, size_t _Nw>
template<class _Elem , class _Traits >
static void _Swc_traits< _Ty, _Mx, _Nw >::_Write ( basic_ostream< _Elem, _Traits > &  _Ostr,
const _Circ_buf< _Ty, _Nw > &  _Buf,
_Cy_t  _Cy 
)
inlinestatic
1030  { // write state to _Ostr
1031  int _Kx = _Get_wc();
1032 
1033  for (int _Ix = 0; _Ix < _Nw; ++_Ix)
1034  for (int _Jx = 1; _Jx <= _Kx; ++_Jx)
1035  { // unpack into _Kx words
1036  unsigned int _Word =
1037  (unsigned int)(_Buf._At(_Ix) >> ((_Kx - _Jx) * 32));
1038  _Ostr << _Word << ' ';
1039  }
1040  _Ostr << _Cy;
1041  }
_CRTIMP _In_opt_z_ const wchar_t _In_opt_z_ const wchar_t unsigned int
Definition: crtdefs.h:642
_Ty _At(int _Ix) const
Definition: random:723
static int _Get_wc()
Definition: random:982
static const _Cy_t _Cy
Definition: random:978

Member Data Documentation

template<class _Ty, _Ty _Mx, size_t _Nw>
const _Cy_t _Swc_traits< _Ty, _Mx, _Nw >::_Cy = 1
static
template<class _Ty, _Ty _Mx, size_t _Nw>
const _Ty _Swc_traits< _Ty, _Mx, _Nw >::_Max = _Mx - 1
static
template<class _Ty, _Ty _Mx, size_t _Nw>
const _Mod_t _Swc_traits< _Ty, _Mx, _Nw >::_Mod = _Mx
static

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