[an error occurred while processing this directive]
|
void fletcher16(u08 volatile *_output, u08 volatile *_buf, u16 _cnt)
{
u16 _s1 = 0x00FF, _s2 = 0x00FF;while(_cnt)
{
u08 _tcnt = _cnt > 21 ? 21 : _cnt;
_cnt -= _tcnt;
do
{
_s1 += *_buf++;
_s2 += _s1;
}
while(--_tcnt);
_s1 = (_s1 & 0xFF) + (_s1 >> 8);
_s2 = (_s2 & 0xFF) + (_s2 >> 8);
};
_s1 = (_s1 & 0xFF) + (_s1 >> 8);
_s2 = (_s2 & 0xFF) + (_s2 >> 8);*_output++ = (u08)_s1 - 1;
*_output = (u08)_s2;
}
ЗЫ
u08 - unsigned char;
u16 - unsigned int.
E-mail: info@telesys.ru