LibJuno
0.42.0
LibJuno is a lightweight C99 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
juno_arc.c
Go to the documentation of this file.
1
/*
2
MIT License
3
4
Copyright (c) 2025 Robin A. Onsay
5
6
Permission is hereby granted, free of charge, to any person obtaining
7
a copy of this software and associated documentation files
8
(the "Software"), to deal in the Software without restriction,
9
including without limitation the rights to use, copy, modify, merge,
10
publish, distribute, sublicense, and/or sell copies of the Software,
11
and to permit persons to whom the Software is furnished to do so,
12
subject to the following conditions:
13
14
The above copyright notice and this permission notice shall be
15
included in all copies or substantial portions of the Software.
16
*/
17
#include "
juno/crc/crc.h
"
18
#include <stdint.h>
19
#include "
arc.h
"
20
21
uint16_t
Juno_CrcArcUpdate
(uint16_t iCrc,
const
void
*pcData,
size_t
zDataSize)
22
{
23
register
uint16_t crc = iCrc;
24
register
const
uint8_t *cp = pcData;
25
register
size_t
cnt = zDataSize;
26
27
while
(cnt--) {
28
crc=((crc>>8)&
M1_16
)^
arc_crctab
[(crc&0xff)^*cp++];
29
}
30
31
return
(crc);
32
}
arc.h
arc_crctab
static const uint16_t arc_crctab[256]
Definition
arc.h:18
crc.h
M1_16
#define M1_16
Definition
crc.h:25
Juno_CrcArcUpdate
uint16_t Juno_CrcArcUpdate(uint16_t iCrc, const void *pcData, size_t zDataSize)
Definition
juno_arc.c:21
src
crc
juno_arc.c
Generated by
1.9.8