Small adaption for x86_64

Discuss new features and future development.

Small adaption for x86_64

Postby joe » Mon Dec 03, 2007 11:14 pm


to compile cleanly on native x86_64 Linux, a small adaption (maybe conditional define) has to be made so the CP_HASH_PAIR macro defined in chipmunk.h, line 72 (I'm referring to SVN rev #192 here):

Code: Select all
#ifndef __x86_64__
#define CP_HASH_PAIR(A, B) ((unsigned int)(A)*CP_HASH_COEF ^ (unsigned int)(B)*CP_HASH_COEF)
#define CP_HASH_PAIR(A, B) ((unsigned long)(A)*CP_HASH_COEF ^ (unsigned long)(B)*CP_HASH_COEF)

The "int" is 4 bytes on x86_64 while the "long" is 8 bytes there (same as sizeof(void*)). On i386 they're both 4 bytes - on my host they emit warnings.

I also think an include guard around chipmunk.h would make sense, wouldn't it?

Why does the Makefile use the -std=gnu99 option instead of the more portable -std=c99 one? If c99 is used the only problem arising is the M_PI symbol, which can be included by writing

Code: Select all
SET(CMAKE_C_FLAGS_RELEASE "-O3 -ffast-math -std=c99 -D_XOPEN_SOURCE=500")

Making the whole thing more portable, as also non-gnu compilers will compile it that way.

Posts: 10
Joined: Sun Dec 02, 2007 3:27 pm

Return to Features/Development

Who is online

Users browsing this forum: No registered users and 1 guest