FACT++  1.0
void Checksum::addLoopSwapping ( const uint16_t *  sbuf,
const uint16_t *  end,
uint32_t *  hilo 
)
inline

Definition at line 101 of file checksum.h.

Referenced by add().

102  {
103  /*
104  for (size_t i = 0; i < len/2; i++)
105  {
106  //swap the bytes of the 32 bits value. but...
107  //the hi and lo values are stored in fits-like order. do not swap them
108  hilo[i%2] += ntohs(sbuf[i]); //(sbuf[i]&0xff00)>>8 | (sbuf[i]&0x00ff)<<8;
109  }*/
110 
111  // This is about as twice as fast as the loop above
112  // ntohs is CPU optimized, i%2 doesn't need to be computed
113  while (1)
114  {
115  if (sbuf==end)
116  break;
117 
118  hilo[0] += ntohs(*sbuf++);
119 
120  if (sbuf==end)
121  break;
122 
123  hilo[1] += ntohs(*sbuf++);
124  }
125  }
double end

+ Here is the caller graph for this function: