summaryrefslogtreecommitdiff
path: root/include/tables_csum.h
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-10-18 10:20:26 -0400
committerTom Rini <trini@konsulko.com>2016-10-18 10:20:26 -0400
commitbb297ceea8bf6cc0291c556f64f49b89368f10ba (patch)
treea37b0d2af3d94480f372129e6aac53dba366937f /include/tables_csum.h
parent644074671e702e8dc0ef642b353845a40f8053da (diff)
parentf822403f0164be74a5161b65698d0f01f4556234 (diff)
Merge git://git.denx.de/u-boot-x86
Diffstat (limited to 'include/tables_csum.h')
-rw-r--r--include/tables_csum.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/tables_csum.h b/include/tables_csum.h
new file mode 100644
index 00000000000..27d147b1643
--- /dev/null
+++ b/include/tables_csum.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef _TABLES_CSUM_H_
+#define _TABLES_CSUM_H_
+
+static inline u8 table_compute_checksum(void *v, int len)
+{
+ u8 *bytes = v;
+ u8 checksum = 0;
+ int i;
+
+ for (i = 0; i < len; i++)
+ checksum -= bytes[i];
+
+ return checksum;
+}
+
+#endif