blob: 5f7edc419ba2dcfebaab9003476ba204b941ddec [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Alexander Graf2b445e42016-08-19 01:23:22 +02002/*
3 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
Alexander Graf2b445e42016-08-19 01:23:22 +02004 */
5
6#ifndef _TABLES_CSUM_H_
7#define _TABLES_CSUM_H_
8
9static inline u8 table_compute_checksum(void *v, int len)
10{
11 u8 *bytes = v;
12 u8 checksum = 0;
13 int i;
14
15 for (i = 0; i < len; i++)
16 checksum -= bytes[i];
17
18 return checksum;
19}
20
21#endif