Hi,
I'm working on a sourcecode for a userlib. To make this sourceode compatible for future versions (the static lib is also available for MacOS X) I could need a kind of #PB_BIG_ENDIAN/#PB_LITTLE_ENDIAN constant ...
http://en.wikipedia.org/wiki/Little_endian
MFG
WolfgangS
#PB_BIG_ENDIAN #PB_LITTLE_ENDIAN
#PB_BIG_ENDIAN #PB_LITTLE_ENDIAN
WolfgangS' projects http://www.schliess.net
Quotation of the month:
<p3hicy>oder ich hol mir so eine geile aus asien
<p3hicy>die ständig poppen will
<p3hicy>'n brötchen pro tag reicht doch
<p3hicy>die essen eh' nich so viel
Quotation of the month:
<p3hicy>oder ich hol mir so eine geile aus asien
<p3hicy>die ständig poppen will
<p3hicy>'n brötchen pro tag reicht doch
<p3hicy>die essen eh' nich so viel
I second that, i've just been using this sort of sloppy code to 'figure out' what endianness the compiler is meant to be using with constants.
What would be handy is an extra qualifier on some commands like readlong() or peekl() to indicate the endianness of the source data. This would be handy for reading files or data from packets because it could 'convert' it automatically. I think its worthy of discussion in any case even if only a few people would ever use it.
Code: Select all
#ENDIAN_BIG.l = $00000000 ; 68K, PPC
#ENDIAN_LITTLE.l = $FFFFFFFF ; x86
CompilerSelect #PB_Compiler_OS :
CompilerCase #OS_Amiga :
#ENDIAN.l = #ENDIAN_BIG
CompilerCase #OS_Windows :
#ENDIAN.l = #ENDIAN_LITTLE
CompilerCase #OS_Linux : ; Does Pure run on non-x86 cpus? I assume it doesnt
#ENDIAN.l = #ENDIAN_LITTLE
CompilerCase #OS_Mac :
#ENDIAN.l = #ENDIAN_BIG
CompilerEndSelect