I want to use the same precision (float) in both my ios and macosx builds of my code. The problem is that the macros in chipmunk_types.h read:
#if defined(__LP64__) && __LP64__
#define CP_USE_DOUBLES 1
#else
#define CP_USE_DOUBLES 0
#endif
Should the code be changed so those lines are ignored if CP_USE_DOUBLES have been already defined?
Thanks!
using floats with macosx
-
- Posts: 6
- Joined: Wed Jun 22, 2011 12:38 pm
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: using floats with macosx
It doesn't look like this? What version are you using?
I thought I changed it to look like that a long time ago.
So it's a little wonky, but you have to set both CP_USE_CGPOINTS to be 0 and CP_USE_DOUBLES to be 0.
Also, why care which floating point precision? Using the same precision won't make the floating point math be the same between different CPUs or compilers. The only thing it does marginally help with is if you are accessing the memory directly like doing binary serialization or vertex arrays for GL or something.
Code: Select all
#ifdef CP_USE_CGPOINTS
#if TARGET_OS_IPHONE
#import <CoreGraphics/CGGeometry.h>
#elif TARGET_OS_MAC
#import <ApplicationServices/ApplicationServices.h>
#endif
#if defined(__LP64__) && __LP64__
#define CP_USE_DOUBLES 1
#else
#define CP_USE_DOUBLES 0
#endif
#endif
So it's a little wonky, but you have to set both CP_USE_CGPOINTS to be 0 and CP_USE_DOUBLES to be 0.
Also, why care which floating point precision? Using the same precision won't make the floating point math be the same between different CPUs or compilers. The only thing it does marginally help with is if you are accessing the memory directly like doing binary serialization or vertex arrays for GL or something.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 6
- Joined: Wed Jun 22, 2011 12:38 pm
- Contact:
Re: using floats with macosx
The problem is that in my case I want to use floats and also CGPoints, that's why I was suggesting the change above, which should be harmless to existing code.
Thanks again for your help!
Thanks again for your help!
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: using floats with macosx
CGFloats (and therefore CGPoints) are defined differently depending on if you are no a 32 or 64 bit system. That's why I have the 64bit check in the typedef.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 16 guests