[fpc-devel] Fix for SwapEndian

Joost van der Sluis joost at cnoc.nl
Wed Apr 30 11:18:59 CEST 2008

Op dinsdag 29-04-2008 om 15:53 uur [tijdzone +0200], schreef Jonas
> On 29 Apr 2008, at 15:41, Joost van der Sluis wrote:
> > I've a problem with BeToN with smallints on a x86 system. When you use
> > BeToN on smallint's with values like $8000 and $8200 it will return
> > values like $FF80 and $FF82, instead or $0080 and $0082 respectively.
> > The patch below fixes this, but I'm not sure if it's a correct fix, or
> > that it's a bug in the compiler. (ie: is this behaviour of shr/shl
> > normal on signed smallints?)

> I don't understand why we have both the swap() and swapendian()  
> routines though, as this duplication (as demonstrated) can easily
> lead  
> to unfixed bugs in one case or the other.

Thanks for fixing it. But coudn't you commit it 5 minutes earlier? Now
it was too late for the postgres-testsuite run. Smallintfields still
fails... ;)

Well, better luck tomorrow. ;)


More information about the fpc-devel mailing list