zephyr/lib/os/crc7_sw.c
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00

20 lines
306 B
C

/*
* Copyright (c) 2018 Google LLC.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <sys/crc.h>
uint8_t crc7_be(uint8_t seed, const uint8_t *src, size_t len)
{
while (len--) {
uint8_t e = seed ^ *src++;
uint8_t f = e ^ (e >> 4) ^ (e >> 7);
seed = (f << 1) ^ (f << 4);
}
return seed;
}