Re: [PATCH 4/4] RISC-V: strcmp [speed optimized]: optimize mismatch logic for targets with Zb* extension support

Kito Cheng <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CA+yXCZAC0QVk7vUtZqn9AOEd22mTTEUE=sQX=cDnJBZ+f-xCrw@mail.gmail.com>
Hi Puranikvinit:

Thanks for your patch, it's really great improvement for the byte
difference detection!

just one minor comment around the code:

> -  ret
> +    #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
> +      ctz a5, a4
> +    #else
> +      clz a5, a4
> +    #endif
> +    andi a5, a5, -8
> +
> +    srl a2, a2, a5
> +    and a2, a2, 0xff

It's great improvement but could you add few comment to explain the
magic here ? :)

> +
> +    srl a3, a3, a5
> +    and a3, a3, 0xff
> +
> +    sub a0, a2, a3
> +    ret
> +  #else
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.