length is 16bit value

This commit is contained in:
Laurent Vivier 2008-08-12 09:12:25 +00:00
parent b5058db8ef
commit 75f78cecb6

View File

@ -1,17 +1,19 @@
static __attribute__((used)) char* rcsid = "$CVSHeader$";
/*
*
* (c) 2004 Laurent Vivier <Laurent@lvivier.info>
* (c) 2004-2008 Laurent Vivier <Laurent@lvivier.info>
*
*/
#include "libemile.h"
#include <stdio.h>
unsigned short emile_checksum(unsigned char *addr, unsigned int length)
{
int j;
unsigned short sum = 0;
length &= 0xFFFF;
for (j = 0; j < length; j++)
{
sum += addr[j];