Re: [PATCH v2] lib/string.c: implement a basic bcmp

2019-03-13 Thread Steven Rostedt
On Wed, 13 Mar 2019 20:34:11 +0100 Rasmus Villemoes wrote: > Yes, but let's completely avoid mentioning memcmp in the summary. > > bcmp - return 0 if and only if the buffers have identical contents > @a: pointer to first buffer > @b: pointer to second buffer > @len: size of buffers > > The

Re: [PATCH v2] lib/string.c: implement a basic bcmp

2019-03-13 Thread Rasmus Villemoes
On 13/03/2019 20.01, Steven Rostedt wrote: > On Wed, 13 Mar 2019 11:51:09 -0700 > Nick Desaulniers wrote: > >>> >>> or have a better comment explaining why its the same. >> >> I could add something about "the signedness of the return code not >> providing any meaning." What would you like to

Re: [PATCH v2] lib/string.c: implement a basic bcmp

2019-03-13 Thread Steven Rostedt
On Wed, 13 Mar 2019 11:51:09 -0700 Nick Desaulniers wrote: > > This is confusing where the comment says "like memcmp but .." and then > > just returns memcmp() unmodified. If anything, I would expect to see > > > > return !!memcmp(cs, ct, conut); > > That's more work than strictly

Re: [PATCH v2] lib/string.c: implement a basic bcmp

2019-03-13 Thread Nick Desaulniers
On Wed, Mar 13, 2019 at 11:40 AM Steven Rostedt wrote: > > On Wed, 13 Mar 2019 11:17:15 -0700 > Nick Desaulniers wrote: > > > +#ifndef __HAVE_ARCH_BCMP > > +/** > > + * bcmp - Like memcmp but a non-zero return code simply indicates a > > non-match. > > + * @cs: One area of memory. > > + * @ct:

Re: [PATCH v2] lib/string.c: implement a basic bcmp

2019-03-13 Thread Steven Rostedt
On Wed, 13 Mar 2019 11:17:15 -0700 Nick Desaulniers wrote: > +#ifndef __HAVE_ARCH_BCMP > +/** > + * bcmp - Like memcmp but a non-zero return code simply indicates a > non-match. > + * @cs: One area of memory. > + * @ct: Another area of memory. > + * @count: The size of the areas. > + */ >

[PATCH v2] lib/string.c: implement a basic bcmp

2019-03-13 Thread Nick Desaulniers
A recent optimization in Clang (r355672) lowers comparisons of the return value of memcmp against zero to comparisons of the return value of bcmp against zero. This helps some platforms that implement bcmp more efficiently than memcmp. glibc simply aliases bcmp to memcmp, but an optimized