FACT++  1.0
template<typename T , typename S >
void bitcpy ( T *  target,
size_t  ntarget,
const S *  source,
size_t  nsource,
size_t  ss = 0,
size_t  ts = 0 
)

Definition at line 87 of file ByteOrder.h.

References t.

Referenced by FTM::DimStaticData::DimStaticData().

88 {
89  const size_t targetsize = ts==0 ? sizeof(T)*8 : std::min(ts, sizeof(T)*8);
90  const size_t sourcesize = ss==0 ? sizeof(S)*8 : std::min(ss, sizeof(S)*8);
91 
92  const S *const ends = source + nsource;
93  const T *const endt = target + ntarget;
94 
95  const S *s = source;
96  T *t = target;
97 
98  memset(t, 0, sizeof(T)*ntarget);
99 
100  size_t targetpos = 0;
101  size_t sourcepos = 0;
102 
103  while (s<ends && t<endt)
104  {
105  // Start filling with "source size" - "position" bits
106  *t |= (*s>>sourcepos)<<targetpos;
107 
108  // Calculate how many bits were siuccessfully copied
109  const int ncopy = std::min(sourcesize-sourcepos, targetsize-targetpos);
110 
111  targetpos += ncopy;
112  sourcepos += ncopy;
113 
114  if (sourcepos>=sourcesize)
115  {
116  sourcepos %= sourcesize;
117  s++;
118  }
119 
120  if (targetpos>=targetsize)
121  {
122  targetpos %= targetsize;
123  t++;
124  }
125 
126  }
127 }
TT t
Definition: test_client.c:26

+ Here is the caller graph for this function: