[crossfire] 64 bit crossfire musings.

Mark Wedel mwedel at sonic.net
Thu May 18 00:59:32 CDT 2006


  Having recently updated my computer to an athlon 64, this creates some issues 
for crossfire.

  Specifically, on 32 bit, sizeof(long)=4, sizeof(long long)=8.
  On 64 bit, sizeof(long)=8, sizeof(long long)=8

  This pretty much means the use of the 'long' type most anywhere in crossfire 
is incorrect, especially if that variable is getting used in a 32 bit context 
(example being if that long is being passed in to SockList_Addint() - that would 
be fine on 32 bit systems, not necessarily good on 64 bit)

  On while long and long long are the same size on my system, it does seem that 
gcc does care that %ld and %lld be used correctly.  I think the fix there is to 
change the global.h so move the sizeof_long_long check before the sizeof_long 
check, so that on x86_64, a uint64 is still defined as a unsigned long long.

  The other more portable approach would be to define the format strings, eg:
#define UINT64_FMT "%ulld"
#define SINT64_FMT "%lld"

  (or %ld, or for windows, %I64 I think) - that would necessitate change 
everyplace that uses those long formats, but that may not be that many.

  Comments/thoughts/suggestions?





More information about the crossfire mailing list