Fix IB in pointer cast to larger type

https://pvs-studio.com/en/docs/warnings/v1091/print/

To convert a 32-bit pointer to a 64-bit integer and avoid
the implementation-defined behavior, do the following:
* Convert a 32-bit pointer to a 32-bit integer.
* Convert the resulting 32-bit integer to a 64-bit integer.
This commit is contained in:
Dmitry Tsarevich 2023-10-10 20:34:05 +03:00
parent c63e5211b3
commit 67105db924
No known key found for this signature in database
GPG Key ID: 3852365567163251
1 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ JoltPhysicsObject::JoltPhysicsObject( JPH::Body *pBody, JoltPhysicsEnvironment *
static_assert( offsetof( JoltPhysicsObject, m_pGameData ) == sizeof( void * ) );
// Set the body's userdata as ourselves
pBody->SetUserData( reinterpret_cast<uint64>( this ) );
pBody->SetUserData( static_cast<uint64>( reinterpret_cast<uintptr_t>(this) ) );
if ( !m_pBody->IsStatic() )
{
JPH::MotionProperties* pMotionProperties = m_pBody->GetMotionProperties();
@ -1178,7 +1178,7 @@ void JoltPhysicsObject::RestoreObjectState( JPH::StateRecorder &recorder )
m_pBody->RestoreState( recorder );
// Set the body's userdata as ourselves
m_pBody->SetUserData( reinterpret_cast<uint64>( this ) );
m_pBody->SetUserData( static_cast<uint64>( reinterpret_cast<uintptr_t>(this) ) );
// Josh: Do not read m_pGameData, as this is not serialized.
//recorder.Read( m_pGameData );