Mail Archives: djgpp/1996/05/16/12:10:41
Errors-To: postmaster AT ns1
Date: Thu, 16 May 96 11:50:51 +1000
From: Adam Hinkley <hinks AT netspace DOT net DOT au>
Cc: <lav AT video DOT yars DOT free DOT net>, <djgpp AT delorie DOT com>, <j DOT aldrich6 AT genie DOT com>
Mime-Version: 1.0
Content-Type: text/plain; charset="US-ASCII"
Content-Length: 1318
>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;
Take your pick. Long long is not a native Intel data type so the endian-ness
of the two longs is irrelevant! It does not matter.
--
Art S. Kagel, kagel AT quasar DOT bloomberg DOT com
A proverb is no proverb to you 'till life has illustrated it. -- John Keats
- Raw text -