Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed_DS28EC20_GPIO
Diff: Utilities/crc.cpp
- Revision:
- 6:a8c83a2e6fa4
- Parent:
- 0:f77ad7f72d04
--- a/Utilities/crc.cpp	Fri Jan 19 10:25:02 2018 -0600
+++ b/Utilities/crc.cpp	Wed Jan 23 13:11:04 2019 -0600
@@ -48,9 +48,8 @@
   return crc;
 }
 
-uint_fast8_t calculateCrc8(const uint_least8_t * data, size_t dataLen,
-                           uint_fast8_t crc) {
-  for (size_t i = 0; i < dataLen; i++) {
+uint_fast8_t calculateCrc8(span<const uint_least8_t> data, uint_fast8_t crc) {
+  for (span<const uint_least8_t>::index_type i = 0; i < data.size(); ++i) {
     crc = calculateCrc8(data[i], crc);
   }
   return crc;
@@ -75,9 +74,9 @@
   return crc;
 }
 
-uint_fast16_t calculateCrc16(const uint_least8_t * data, size_t dataLen,
+uint_fast16_t calculateCrc16(span<const uint_least8_t> data,
                              uint_fast16_t crc) {
-  for (size_t i = 0; i < dataLen; i++) {
+  for (span<const uint_least8_t>::index_type i = 0; i < data.size(); ++i) {
     crc = calculateCrc16(data[i], crc);
   }
   return crc;