zephyr/lib/os/crc7_sw.c
Gerard Marull-Paretas cbd31d720b lib: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all lib code to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to zephyrproject-rtos#45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:09 +02:00

20 lines
313 B
C

/*
* Copyright (c) 2018 Google LLC.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/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;
}