[PATCH v11 20/29] riscv: Add string-fza.h and string-fzi.h

Richard Henderson richard.henderson@linaro.org
Sun Feb 5 17:33:46 GMT 2023


On 2/4/23 06:31, Jeff Law wrote:
> 
> 
> On 2/2/23 05:30, Adhemerval Zanella Netto wrote:
>>
>>
>> On 01/02/23 14:53, Richard Henderson wrote:
>>> On 2/1/23 07:03, Adhemerval Zanella wrote:
>>>> +static __always_inline unsigned int
>>>> +index_first (find_t c)
>>>> +{
>>>> +  if (c & 0x80U)
>>>> +    return 0;
>>>> +  if (c & 0x8000U)
>>>> +    return 1;
>>>> +  if (c & 0x800000U)
>>>> +    return 2;
>>>> +
>>>> +  if (sizeof (op_t) == 4)
>>>> +    return 3;
>>>> +
>>>> +  if (c & 0x80000000U)
>>>> +    return 3;
>>>> +  if (c & 0x8000000000UL)
>>>> +    return 4;
>>>> +  if (c & 0x800000000000UL)
>>>> +    return 5;
>>>> +  if (c & 0x80000000000000UL)
>>>> +    return 6;
>>>> +  return 7;
>>>
>>> There is a -mbig-endian switch to gcc, even if that isn't the normal configuration.
>>
>> I though about adding BE support, however we explicit do not support it
>> (sysdeps/riscv/bits/endianness.h) so I think we can assume LE for now.
> I wouldn't bother with BE until someone comes asking for it.

My only point is there's a compiler switch, and this function is incorrect in that 
context.  One could either #error or not use this specialization.


r~


More information about the Libc-alpha mailing list