void* -> int cast in btCompoundCollisionAlgorithm.cpp

sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

void* -> int cast in btCompoundCollisionAlgorithm.cpp

Post by sparkprime »

Line 144 has

Code: Select all

int index = int(leaf->data);
Gcc will generate an error here on 64 bit platforms. One solution is to use long instead of int. However the better solution is probably to templatise btDbvtNode so that the data variable is the right type in the first place. This could also be used to avoid the union. This may result in some small memory savings and the code would generally be more elegant.

Any thoughts?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: void* -> int cast in btCompoundCollisionAlgorithm.cpp

Post by Erwin Coumans »

It has been fixed now, keeping is simple:

Code: Select all

union	{
	btDbvtNode*	childs[2];
	void*	data;
	int		dataAsInt;
};
Templatizing this would be cumbersome and we can't justify the hassle,

Thanks for the feedback,
Erwin