You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Da...@lotus.com on 2000/10/11 21:13:48 UTC
Re: 64bit Xerces under SGI IRIX
Those don't look like standard defines. Why not:
if (sizeof(int) == sizeof(void*))
{
return ((int)key % mod);
}
else
{
return ((long)key % mod);
}
Since sizeof() is a compile-time operator, a good optimizer ought to remove
the run-time cost of the if statement.
There might be a better way that wouldn't require the cast, but I'm a bit
slow this late in the day, so I can't think of it right now.
Dave
"David Nickerson"
<d.nickerson@auckl To: "xerces-c-dev" <xe...@xml.apache.org>
and.ac.nz> cc: (bcc: David N Bertoni/CAM/Lotus)
Subject: 64bit Xerces under SGI IRIX
10/12/2000 06:49
AM
Please respond to
xerces-c-dev
Hi,
Just been building the various versions of Xerces-C 1.3.0 that I require
using MIPSpro 7.3.1.1m compilers under IRIX 6.5.4.
The 32bit versions worked perfectly, but I had to make the following change
in src/util/HashPtr.cpp to get the 64bit versions to build
unsigned int HashPtr::getHashVal(const void *const key, unsigned int mod)
{
#if _SIZE_PTR == _SIZE_INT
return ((int)key % mod);
#else
return ((long)key % mod);
#endif
}
due to void * being a different size to int in a 64bit version.
Does this seem like a good way to do this?? Are _SIZE_PTR and _SIZE_INT
used
on other platforms, or are they IRIX specific ??
David.
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: 64bit Xerces under SGI IRIX
Posted by Andy Heninger <an...@jtcsv.com>.
From: <Da...@lotus.com>
>
> Those don't look like standard defines. Why not:
>
> if (sizeof(int) == sizeof(void*))
> {
> return ((int)key % mod);
> }
> else
> {
> return ((long)key % mod);
> }
>
Why not just
> return ((long)key % mod);
The 32 bit machines mostly have a 32 bit long, and even if some one
of them had a 64 bit long, promoting the pointer to a long in this
way should be something the compiler would optimize out decently.
Andy Heninger
IBM XML Technology Group, Cupertino, CA
heninger@us.ibm.com