From b0a8154e9673c9615ccc7ba6a94e349172ca2fb8 Mon Sep 17 00:00:00 2001 From: nvt-se Date: Thu, 14 May 2009 12:05:04 +0000 Subject: [PATCH] make it possible to accumulate CRC values through crc16_data. --- core/lib/crc16.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/lib/crc16.c b/core/lib/crc16.c index 4508426b0..209211bb3 100644 --- a/core/lib/crc16.c +++ b/core/lib/crc16.c @@ -28,7 +28,7 @@ * * This file is part of the Contiki operating system. * - * @(#)$Id: crc16.c,v 1.3 2008/08/26 21:46:06 adamdunkels Exp $ + * @(#)$Id: crc16.c,v 1.4 2009/05/14 12:05:04 nvt-se Exp $ */ /** \addtogroup crc16 @@ -67,13 +67,12 @@ unsigned short crc16_data(const unsigned char *data, int len, unsigned short acc) { int i; - unsigned short crc = 0; for(i = 0; i < len; ++i) { - crc = crc16_add(*data, crc); + acc = crc16_add(*data, acc); ++data; } - return crc; + return acc; } /*---------------------------------------------------------------------------*/