]>
git.ipfire.org Git - thirdparty/u-boot.git/blob - lib/crc8.c
1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2013 Google, Inc
11 #include <u-boot/crc.h>
13 #define POLY (0x1070U << 3)
15 static unsigned char _crc8(unsigned short data
)
19 for (i
= 0; i
< 8; i
++) {
25 return (unsigned char)(data
>> 8);
28 unsigned int crc8(unsigned int crc
, const unsigned char *vptr
, int len
)
32 for (i
= 0; i
< len
; i
++)
33 crc
= _crc8((crc
^ vptr
[i
]) << 8);