On 4/30/2014 3:28 PM, koeppea wrote:
> In src/ec_checksum.c:
>
>>     if(nleft) {
>> -      *(u_int8*)&tmp = *(u_int8*)cbuf;
>> -      csum += tmp;
>> +      union u_pun u = { .b[0] = cbuf[0], .b[1] = 0 };
>
> In this case we have only 1 byte left in the buffer.
> @git-tomc <https://github.com/git-tomc> Why is it added by *u_int16* and
> the last 8 bit padded?

The algorithm operates over 16-bit integers in network (Motorola) order.

When we have one byte left, it is the low byte off the word. The high 
byte of the word is zero.

~ Tom