On 10/27/16 20:04, Bernd Schmidt wrote:
> On 10/27/2016 05:57 PM, Bernd Edlinger wrote:
>> In the function below we have if ((UWtype)u == u)
>> that actually ensures hi != 0.
>
> Ah, right. So maybe we ought to just add the same case here as well?
>
> if ((UWtype)u == u)
> return (FSTYPE)(UWtype)u;
>
> That would also make the comment less misleading. The condition should
> ensure that u is positive and representable in UWtype, so this should be
> correct, right?
>
you mean:
if ((Wtype)u == u)
return (FSTYPE)(Wtype)u;
if ((UWtype)u == u)
return (FSTYPE)(UWtype)u;
I think, that should work as well, yes.
OTOH there is a possibility that COUNT_LEADING_ZEROS_0
indicates that we will not need any extra checks here.
Bernd.