For this series: Reviewed-and-tested-by: Bill Fischofer <[email protected]>
On Fri, Jan 29, 2016 at 7:59 AM, Petri Savolainen < [email protected]> wrote: > Memory compare is a commonly used C library function on > data plane applications. This enables using HW offload > (e.g. vector unit) for compare operations. > > Signed-off-by: Petri Savolainen <[email protected]> > --- > include/odp/api/std_clib.h | 18 ++++++++++++++++++ > platform/linux-generic/include/odp/std_clib.h | 5 +++++ > 2 files changed, 23 insertions(+) > > diff --git a/include/odp/api/std_clib.h b/include/odp/api/std_clib.h > index 2119ec4..791b72f 100644 > --- a/include/odp/api/std_clib.h > +++ b/include/odp/api/std_clib.h > @@ -54,6 +54,24 @@ void *odp_memcpy(void *dst, const void *src, size_t > num); > void *odp_memset(void *ptr, int value, size_t num); > > /** > + * Memcmp > + * > + * ODP version of C library memcmp function. It compares first 'num' > bytes of > + * memory blocks pointed by 'ptr1' and 'ptr2'. > + * > + * @param ptr1 Pointer to a memory block > + * @param ptr2 Pointer to a memory block > + * @param num Number of bytes to compare > + * > + * @retval 0 when the contents of memory blocks match > + * @retval <0 when the contents of memory blocks do not match, and > + * block 'ptr1' is less than block 'ptr2' > + * @retval >0 when the contents of memory blocks do not match, and > + * block 'ptr1' is greater than block 'ptr2' > + */ > +int odp_memcmp(const void *ptr1, const void *ptr2, size_t num); > + > +/** > * @} > */ > > diff --git a/platform/linux-generic/include/odp/std_clib.h > b/platform/linux-generic/include/odp/std_clib.h > index c939c48..11c59be 100644 > --- a/platform/linux-generic/include/odp/std_clib.h > +++ b/platform/linux-generic/include/odp/std_clib.h > @@ -23,6 +23,11 @@ static inline void *odp_memset(void *ptr, int value, > size_t num) > return memset(ptr, value, num); > } > > +static inline int odp_memcmp(const void *ptr1, const void *ptr2, size_t > num) > +{ > + return memcmp(ptr1, ptr2, num); > +} > + > #ifdef __cplusplus > } > #endif > -- > 2.6.3 > > _______________________________________________ > lng-odp mailing list > [email protected] > https://lists.linaro.org/mailman/listinfo/lng-odp >
_______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
