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 |
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); } /**