tables_csum.h 333 B

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