[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Devel] RE: compiling FreeType library for 64 bit code
From: |
David Turner |
Subject: |
Re: [Devel] RE: compiling FreeType library for 64 bit code |
Date: |
Fri, 25 Oct 2002 14:06:23 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2a) Gecko/20020910 |
Hello Keith,
Keith Trummel wrote:
FYI,
Changing line 186 in the file ftcache.h from
#define FTC_FACE_ID_HASH( i ) ((FT_UInt32)(FT_Pointer)( i ))
to be:
#define FTC_FACE_ID_HASH( i ) ((FT_UInt32)((unsigned long) i &
0xffffffffL))
fixes the problem when producing 64 bit code both using Sun's C++ compiler
and IBM's C++ compiler. Presumably, it also still keeps the hashing
performance reasonable.
Keith
Thanks for spotting this. However I suspect that:
- FT_UInt32 is really a typedef for "unsigned int" on your
system.
- your compilers refuse to directly cast a pointer into
an "unsigned int", but will accept casts to "unsigned long"
instead (which are, I assume 64-bit)
- your fix will not work very well for everyone. Certain
compilers will warn or refuse to cast any typed pointer to
a ulong (they only want a void*); and the AND mask is
superfluous (since the exact same operation is performed
by the cast to FT_UInt32)
I'd thus rather suggest changing it to:
#define FTC_FACE_ID_HASH( i ) ((FT_UInt32)(FT_ULong)(FT_Pointer)(i))
or even better:
#define FT_POINTER_TO_ULONG(p) ((FT_ULong)(FT_Pointer)(p))
#define FTC_FACE_ID_HASH( i ) ((FT_UInt32)(( FT_POINTER_TO_ULONG(p) >> 3 ) ^
\
( FT_POINTER_TO_ULONG(p) << 7 ) ))
which gets rid of 8-byte alignment effects which are so common with
"malloc-ed" memory addresses.
Werner, I don't have access to the CVS repository. Could you check this in ??
Thanks for spotting it through..
Regards,
- David Turner
- The FreeType Project (www.freetype.org)
-----Original Message-----
From: Keith Trummel
Sent: Thursday, October 17, 2002 3:29 PM
To: 'address@hidden'
Subject: compiling FreeType library for 64 bit code
Hello,
I was wondering if anyone had compiled the FreeType library (2.1.2)
for use with a 64 bit executable. When I attempted to compile the code on
Solaris I get problems because there are several places where it attempts
to convert pointers to 32 bit ints.
Specifically when compiling the code in the cache subdirectory I get:
"src/cache/ftcimage.c", line 243: Error: Cannot cast from void* to
unsigned.
"src/cache/ftcsbits.c", line 392: Error: Cannot cast from void* to
unsigned.
"src/cache/ftccmap.c", line 220: Error: Cannot cast from void* to
unsigned.
Keith Trummel
Scene7 Inc.
_______________________________________________
Devel mailing list
address@hidden
http://www.freetype.org/mailman/listinfo/devel