[fpc-devel] bitshift intrinsics

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Oct 14 11:56:23 CEST 2016

On 14/10/16 11:44, Marco van de Voort wrote:
> 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.

> So the questions are:
> 1. why do the primitives deliver a signed result ?


> 2. why do they not all deliver -1 for their with ($FFFF for 2-byte etc).

Probably because that is how the originally submitted generic 
implementation behaved: http://bugs.freepascal.org/view.php?id=17592

> 3. (for Michael: :-) why doesn't the documentation doesn't mention the
> behaviour for no bits set?).
> Since (3) the behaviour is not documented, we can still fix this ? :-)

They've behaved like this since FPC 2.6.0, so no.


More information about the fpc-devel mailing list