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 unsigned int _UCy_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 constexpr _Cy_t _Cy = 1
 
static constexpr _Mod_t _Mod = _Mx
 
static constexpr _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
template<class _Ty, _Ty _Mx, size_t _Nw>
typedef unsigned int _Swc_traits< _Ty, _Mx, _Nw >::_UCy_t

Member Function Documentation

template<class _Ty, _Ty _Mx, size_t _Nw>
static int _Swc_traits< _Ty, _Mx, _Nw >::_Get_wc ( )
inlinestatic
972  { // compute number of 32-bit words per element
973  int _Kx;
974 
975  if (_Mx == 0)
976  _Kx = (_BITS_BYTE * sizeof (_Ty) + 31) / 32;
977  else
978  { // compute number of 32-bit words required
979  unsigned long long _Val = 1ULL << 32;
980  for (_Kx = 1; 0 < _Val && _Val < _Mx; ++_Kx)
981  _Val = _Val << 32;
982  }
983  return (_Kx);
984  }
#define _BITS_BYTE
Definition: random:19
_FwdIt const _Ty _Val
Definition: algorithm:1938
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
988  { // set initial values of _Ax from generator _Gx
989  // return value of _Cy from range if _Readcy is true,
990  // otherwise compute from last value
991  int _Kx = _Get_wc();
992 
993  for (int _Ix = 0; _Ix < _Nw; ++_Ix)
994  { // pack _Kx words
995  _Ax[_Ix] = _Gx();
996  for (int _Jx = 0; ++_Jx < _Kx; )
997  {
998  _Ax[_Ix] |= (_Ty)_Gx() << (32 * _Jx);
999  }
1000  }
1001 
1002  _Cy_t _Ans = _Reduce(_Ax);
1003  if (!_Readcy)
1004  {
1005  return (_Ans);
1006  }
1007  else
1008  {
1009 #pragma warning(push)
1010 #pragma warning(disable: 4244) // TRANSITION, conversion from 'X' to 'Y', possible loss of data
1011  return (_Gx());
1012 #pragma warning(pop)
1013  }
1014  }
static _Cy_t _Reduce(_Ty *_Ax)
Definition: random:1018
int _Cy_t
Definition: random:962
static int _Get_wc()
Definition: random:971
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
1031  { // write state to _Ostr
1032  int _Kx = _Get_wc();
1033 
1034  for (int _Ix = 0; _Ix < _Nw; ++_Ix)
1035  for (int _Jx = 1; _Jx <= _Kx; ++_Jx)
1036  { // unpack into _Kx words
1037  unsigned int _Word =
1038  (unsigned int)(_Buf._At(_Ix) >> ((_Kx - _Jx) * 32));
1039  _Ostr << _Word << ' ';
1040  }
1041  _Ostr << _Cy;
1042  }
static constexpr _Cy_t _Cy
Definition: random:967
_Ty _At(int _Ix) const
Definition: random:700
static int _Get_wc()
Definition: random:971
char int *typedef int(__CRTDECL *_CRT_REPORT_HOOKW)(int
Definition: crtdbg.h:45

Member Data Documentation

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

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