mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
Merge remote-tracking branch 'origin/topic/johanna/gcc-6.2.1'
BIT-1732 #merged * origin/topic/johanna/gcc-6.2.1: Fix alignment issue of ones_complement_checksum
This commit is contained in:
commit
c57f83d8bf
3 changed files with 12 additions and 3 deletions
6
CHANGES
6
CHANGES
|
@ -1,4 +1,10 @@
|
||||||
|
|
||||||
|
2.5-beta-93 | 2016-10-24 11:11:07 -0700
|
||||||
|
|
||||||
|
* Fix alignment issue of ones_complement_checksum. This error
|
||||||
|
occured reproducibly newer compilers when called from
|
||||||
|
icmp6_checksum. (Johanna Amann)
|
||||||
|
|
||||||
2.5-beta-91 | 2016-10-20 11:40:37 -0400
|
2.5-beta-91 | 2016-10-20 11:40:37 -0400
|
||||||
|
|
||||||
* Fix istate.pybroccoli test on systems using Python 3. (Daniel Thayer)
|
* Fix istate.pybroccoli test on systems using Python 3. (Daniel Thayer)
|
||||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
2.5-beta-91
|
2.5-beta-93
|
||||||
|
|
|
@ -18,13 +18,16 @@
|
||||||
// Returns the ones-complement checksum of a chunk of b short-aligned bytes.
|
// Returns the ones-complement checksum of a chunk of b short-aligned bytes.
|
||||||
int ones_complement_checksum(const void* p, int b, uint32 sum)
|
int ones_complement_checksum(const void* p, int b, uint32 sum)
|
||||||
{
|
{
|
||||||
const u_short* sp = (u_short*) p; // better be aligned!
|
const unsigned char* sp = (unsigned char*) p;
|
||||||
|
|
||||||
b /= 2; // convert to count of short's
|
b /= 2; // convert to count of short's
|
||||||
|
|
||||||
/* No need for endian conversions. */
|
/* No need for endian conversions. */
|
||||||
while ( --b >= 0 )
|
while ( --b >= 0 )
|
||||||
sum += *sp++;
|
{
|
||||||
|
sum += *sp + (*(sp+1) << 8);
|
||||||
|
sp += 2;
|
||||||
|
}
|
||||||
|
|
||||||
while ( sum > 0xffff )
|
while ( sum > 0xffff )
|
||||||
sum = (sum & 0xffff) + (sum >> 16);
|
sum = (sum & 0xffff) + (sum >> 16);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue