box2d-firemonkey icon indicating copy to clipboard operation
box2d-firemonkey copied to clipboard

UPhysics.pas problem with 64b compiler

Open omarreis opened this issue 9 years ago • 0 comments

In UPhysics.pas there are two pointer arithmetic problems with 64 bit compilers. The code is typecasting a pointer as an Integer. A pointer is really a NativeUInt.

// PInt32( Integer(m_stack) + SizeOf(Int32) * m_count)^ := element; //wrong // Integer(m_stack) truncates m_stack pointer, causing invalid access. PInt32( NativeUInt(m_stack) + SizeOf(Int32) * m_count)^ := element; //correct

and also

//Result := PInt32(Integer(m_stack) + SizeOf(Int32) * m_count)^; Result := PInt32(NativeUInt(m_stack) + SizeOf(Int32) * m_count)^;

omarreis avatar Oct 28 '16 10:10 omarreis