On Sat, 4 Feb 2006, Serghei Amelian wrote:
Are cineva idee daca exista vreo directiva de preprocesor la GCC care sa-mi
indice daca sunt pe platforma big endian sau pe little endian?
#ifdef BIG_ENDIAN
?
sau LITTLE_ENDIAN
Am codul asta:
bool readUInt32(const unsigned char *str, unsigned int *tgt)
{
*tgt = 0;
unsigned int b0, b1, b2, b3;
b0 = str[0];
b1 = str[1];
b2 = str[2];
b3 = str[3];
if(bigEndian)
*tgt = (b3 | (b2 << 8) | (b1 << 16) | (b0 << 24));
else
*tgt = (b0 | (b1 << 8) | (b2 << 16) | (b3 << 24));
return true;
}
In principiu incarc niste fisiere TIFF de pe disk si pe acolo exista tot felul
de informatii de offset cu care gasesc locatia paginilor. Si platforma si
tiff-ul pot fi little/big endian. La tiff nu e problema ca zice in antet de
care e. Alta chestie: codul de mai sus poate functiona pe alte platforme
decat x86? Mentionez ca nu am nici un fel de experienta pe alte platforme
decat Intel pe 32 biti.
Thanks
--
Serghei.
TOP POSTING SUX
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug
--
"frate, trezeste-te, aici nu-i razboiul stelelor"
Radu R. pe offtopic at lug.ro
_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug