src: Use static_cast instead of reinterpret_cast if possible