[fpc-pascal] Switch Endian

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Aug 21 09:39:16 CEST 2009


On 21 Aug 2009, at 09:30, luca_manganelli at comune.trento.it wrote:

> there's a pascal function to switch endian (for a 32 bit integer)?  
> Note
> that it should work on 64 bit systems...

Use SwapEndian(longint(value)). The extra longint type cast is to  
ensure that you call the 32 bit version, regardless of the result type  
of the expression. We still have to add extra swapendianword/ 
swapendiandword/... etc functions which unambiguously specify the size  
they operate on.


Jonas



More information about the fpc-pascal mailing list