Commit Graph

3 Commits

Author SHA1 Message Date
Wyatt Hepler
eb8a34c43f pw_checksum: CRC classes; Update CRC-16-CCITT name
- Rename CcittCrc16 and related functions to Crc16Ccitt, which matches
  the algorithm's full standard name (CRC-16-CCITT).
- Create classes for calculating the CRC-16-CCITT and CRC-32. Use the
  function names, which were nouns, as the class names (Crc16Ccitt and
  Crc32) and provide the functions as class static functions
  (Crc16Ccitt::Calculate and Crc32::Calculate).

Change-Id: I625ed715935de3f1000d3119c21a2f6d01245173
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/17403
Reviewed-by: Keir Mierle <keir@google.com>
2020-09-09 16:34:22 +00:00
Wyatt Hepler
a6e20bfe97 pw_checksum: Fix CRC32 linker issue
- The CRC32 code fails to build in optimized builds. The inline keyword
  differs in meaning between C and C++. Inline C functions need to be
  declared static inline to link equivalently to an inline C++ function.
  Add static to the inline C function.
- Expand some comments.

Change-Id: I16a12bc0cbb666efbf5c479c6ff6a48d94ca5e1f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/13840
Reviewed-by: David Rogers <davidrogers@google.com>
Commit-Queue: Wyatt Hepler <hepler@google.com>
2020-07-14 18:30:24 +00:00
Zihan Chen
0a7db3e38b pw_checksum: Add CRC32 support
Change-Id: Ife7a384658e1515aff2a096e3890bac6d0accfa7
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/12843
Reviewed-by: Wyatt Hepler <hepler@google.com>
Commit-Queue: Zihan Chen <zihanchen@google.com>
2020-07-08 00:41:46 +00:00