diff mbox series

[API-NEXT,v1,1/2] helper: use new odp checksum API

Message ID 1510066821-31264-2-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v1,1/2] helper: use new odp checksum API | expand

Commit Message

Github ODP bot Nov. 7, 2017, 3 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Use odp_chksum_ones_comp16 which may be platform-optimized.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 280 (lumag:chksum)
 ** https://github.com/Linaro/odp/pull/280
 ** Patch: https://github.com/Linaro/odp/pull/280.patch
 ** Base sha: d22c949cc466bf28de559855a1cb525740578137
 ** Merge commit sha: 93032be4dd8c5d534c9898a54df6cb7977522c80
 **/
 helper/include/odp/helper/chksum.h | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/helper/include/odp/helper/chksum.h b/helper/include/odp/helper/chksum.h
index 1bf950c8b..f8d05236a 100644
--- a/helper/include/odp/helper/chksum.h
+++ b/helper/include/odp/helper/chksum.h
@@ -44,21 +44,7 @@  typedef enum {
  */
 static inline odp_u16sum_t odph_chksum(void *buffer, int len)
 {
-	uint16_t *buf = (uint16_t *)buffer;
-	uint32_t sum = 0;
-	uint16_t result;
-
-	for (sum = 0; len > 1; len -= 2)
-		sum += *buf++;
-
-	if (len == 1)
-		sum += *(unsigned char *)buf;
-
-	sum = (sum >> 16) + (sum & 0xFFFF);
-	sum += (sum >> 16);
-	result = ~sum;
-
-	return  (__odp_force odp_u16sum_t) result;
+	return ~odp_chksum_ones_comp16(buffer, len);
 }
 
 /**