blob: 305b1ec31c5488a7417ff6d8ceedac06d6e5e35d [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Alexander Graf1befb382016-08-19 01:23:21 +02002/*
3 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
Alexander Graf1befb382016-08-19 01:23:21 +02004 */
5
Tom Rini467382c2023-12-14 13:16:58 -05006#include <linux/types.h>
Alexander Graf1befb382016-08-19 01:23:21 +02007
Heinrich Schuchardte3db8d62024-01-09 09:36:44 +01008u8 table_compute_checksum(const void *v, const int len)
Alexander Graf1befb382016-08-19 01:23:21 +02009{
Heinrich Schuchardte3db8d62024-01-09 09:36:44 +010010 const u8 *bytes = v;
Alexander Graf1befb382016-08-19 01:23:21 +020011 u8 checksum = 0;
12 int i;
13
14 for (i = 0; i < len; i++)
15 checksum -= bytes[i];
16
17 return checksum;
18}