replace static_cast with reinterpret_cast