diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2013-06-06 01:00:31 +0200 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-06-17 17:30:13 +0200 |
commit | b1092362e2c2ab04c38061b2701184a8423d99a2 (patch) | |
tree | c9fdd239099c42c75fc94bed858ab06aed2a9c52 /ax25 | |
parent | d2f98fb039a1dd860afc4b3a78ddb408c4f0a42b (diff) |
axgetput: Provide calc_crc() function to iterate over memory area.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'ax25')
-rw-r--r-- | ax25/axgetput/proto_bin.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/ax25/axgetput/proto_bin.c b/ax25/axgetput/proto_bin.c index aeee8bd..d61f72a 100644 --- a/ax25/axgetput/proto_bin.c +++ b/ax25/axgetput/proto_bin.c @@ -41,6 +41,14 @@ static int do_crc(char b, unsigned int crc) return crc; } +unsigned int calc_crc(char *buf, int n, unsigned crc) +{ + while (--n >= 0) + crc = do_crc(*buf++, crc); + + return crc; +} + /*---------------------------------------------------------------------------*/ static long parse_sfbin_date_to_unix(const char *s) |