This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v3 04/18] Add string vectorized find and detection functions
On Wed, 10 Jan 2018, Adhemerval Zanella wrote:
> +
> +static inline unsigned char
> +extractbyte (op_t x, unsigned idx)
Missing comment on the semantics of this function. "unsigned int".
> +/* For architecture which only provides __builtin_clz{l} (HAVE_BUILTIN_CLZ)
> + and/or __builtin_ctz{l} (HAVE_BUILTIN_CTZ) which uses external libcalls
> + (for intance __c{l,t}z{s,d}i2 from libgcc) the following wrapper provides
> + inline implementation for both count leading zeros and count trailing
> + zeros using branchless computation. */
I think the comments need to say a bit more about the semantics of these
functions. In particular, do they follow the same rule as the built-in
functions that behavior is undefined if the argument is zero? If they do,
then I'd expect the comments on the functions that call them to specify
that they must not be called with a zero argument (zero arguments in this
case generally corresponding to words that are not at the end of the
string etc., so the functions indeed don't get called in that case).
--
Joseph S. Myers
joseph@codesourcery.com