[fpc-devel] bitshift intrinsics

Florian Klämpfl florian at freepascal.org
Fri Oct 14 22:29:41 CEST 2016


Am 14.10.2016 um 14:25 schrieb Marco van de Voort:
> In our previous episode, Jonas Maebe said:
>>> If the dword version returned $FFFFFFFF it could be at least typecasted to
>>> -1.
>>
>> You can typecast the result to shortint to get -1 in that case.
> 
> That removes the additional branch, reducing it to a movsbl, so I assume the
> resulting code is better, thanks.
>  
>>> So the questions are:
>>> 1. why do the primitives deliver a signed result ?
>>
>> *unsigned
> 
> True, but question still stands. Anyway, I'll wait if FLorian recollects
> anything.

I guess the reason was that no more than one byte is needed for the result of bs*. But I agree, the
decision was not very well thought.




More information about the fpc-devel mailing list