qemu-e2k/include/qemu/crc-ccitt.h
Philippe Mathieu-Daudé f703f1ef99 bulk: Do not declare function prototypes using 'extern' keyword
By default, C function prototypes declared in headers are visible,
so there is no need to declare them as 'extern' functions.
Remove this redundancy in a single bulk commit; do not modify:

  - meson.build (used to check function availability at runtime)
  - pc-bios/
  - libdecnumber/
  - tests/
  - *.c

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20230605175647.88395-5-philmd@linaro.org>
2023-08-31 19:47:43 +02:00

34 lines
824 B
C

/*
* CRC16 (CCITT) Checksum Algorithm
*
* Copyright (c) 2021 Wind River Systems, Inc.
*
* Author:
* Bin Meng <bin.meng@windriver.com>
*
* From Linux kernel v5.10 include/linux/crc-ccitt.h
*
* SPDX-License-Identifier: GPL-2.0
*/
#ifndef CRC_CCITT_H
#define CRC_CCITT_H
extern uint16_t const crc_ccitt_table[256];
extern uint16_t const crc_ccitt_false_table[256];
uint16_t crc_ccitt(uint16_t crc, const uint8_t *buffer, size_t len);
uint16_t crc_ccitt_false(uint16_t crc, const uint8_t *buffer, size_t len);
static inline uint16_t crc_ccitt_byte(uint16_t crc, const uint8_t c)
{
return (crc >> 8) ^ crc_ccitt_table[(crc ^ c) & 0xff];
}
static inline uint16_t crc_ccitt_false_byte(uint16_t crc, const uint8_t c)
{
return (crc << 8) ^ crc_ccitt_false_table[(crc >> 8) ^ c];
}
#endif /* CRC_CCITT_H */