Squashed commit of the following:
commit
e4482a20e1e3c5720bd83d999baba9e6baffe5da
Author: Michael Altizer <mialtize@cisco.com>
Date: Mon Oct 7 15:13:32 2019 -0400
codecs: Fix checksumming a single byte of unaligned data
cksum += *sp++;
len -= 2;
}
- // if len was odd, sum in the last byte...
- if ( len )
- cksum += (uint16_t) *(const uint8_t *)sp;
}
else if ( len > 1 )
{
cksum += sp[15];
sp += 16;
}
- // if len is odd, sum in the last byte...
- if ( len & 0x01)
- cksum += (uint16_t) *(const uint8_t *)sp;
}
+ // if len is odd, sum in the last byte...
+ if ( len & 0x01 )
+ cksum += *((const uint8_t*) sp);
+
cksum = (cksum >> 16) + (cksum & 0x0000ffff);
cksum += (cksum >> 16);