tables_csum.h 333 B

123456789101112131415161718192021
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
  4. */
  5. #ifndef _TABLES_CSUM_H_
  6. #define _TABLES_CSUM_H_
  7. static inline u8 table_compute_checksum(void *v, int len)
  8. {
  9. u8 *bytes = v;
  10. u8 checksum = 0;
  11. int i;
  12. for (i = 0; i < len; i++)
  13. checksum -= bytes[i];
  14. return checksum;
  15. }
  16. #endif