Mail Archives: djgpp/1996/05/15/21:48:24
>The old v1.x library sources archive (djlsr112.zip) included the sources
>for these functions; if you can get that, you won't need to download the
>multi-megabyte gcc distribution.
This source is for a big endian right?
I don't have the definition for DItype, but the PowerPC is a little
endian, which means I have defined it as:
typedef struct {
long high; // little endian
unsigned long low;
} DItype;
Would I be correct in saying the big endian version would make "low"
signed instead of "high"?
So, am I correct in assuming that if djlsr112 typecasts low to unsigned,
I should do the opposite?
For example, if this is for big endians....
if (au.s.high < bu.s.high)
return -1;
else if (au.s.high > bu.s.high)
return 1;
if ((unsigned long) au.s.low < (unsigned long)bu.s.low)
return -1;
else if ((unsigned long) au.s.low > (unsigned long)bu.s.low)
return 1;
...then to make it work on little endians, I should change it to...
if ((unsigned long)au.s.high < (unsigned long)bu.s.high)
return -1;
else if ((unsigned long)au.s.high > (unsigned long)bu.s.high)
return 1;
if (au.s.low < bu.s.low)
return -1;
else if (au.s.low > bu.s.low)
return 1;
Correct?
Thanks
Adam
- Raw text -