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 ?
True, but question still stands. Anyway, I'll wait if FLorian recollects
> > 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.
Looking at the generic (non cpu) version with the lookup table, the reason
for $ff becomes somewhat logical. It is bytewise, and $FF is the value of 0
in the per byte table.
Anyway, I just wanted to avoid floating point in the original case, and it
was not really extremely speeddependent. I just wondered.
I've filed a doc bug 30740 so that at least something good comes out of it.
fpc-devel maillist - email@example.com