Refactor build system to use waf. Waf is better at handling dependency paths which I need for IDL support
This commit is contained in:
parent
df7f98bc6f
commit
9fd10dec9c
77 changed files with 312 additions and 86 deletions
20
crc16.c
Normal file
20
crc16.c
Normal file
|
@ -0,0 +1,20 @@
|
|||
#include <stdint.h>
|
||||
|
||||
uint16_t calculate_crc (const uint8_t *ptr, uint16_t count) {
|
||||
#define CRC16_SEED 0x1021
|
||||
uint16_t crc;
|
||||
uint8_t i;
|
||||
crc = 0;
|
||||
|
||||
while (count-- > 0) {
|
||||
crc = crc ^ ((uint16_t) *ptr++ << 8);
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (crc & 0x8000) {
|
||||
crc = crc << 1 ^ CRC16_SEED;
|
||||
} else {
|
||||
crc = crc << 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return crc;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue