diff --git a/CPP/Clipper2Lib/include/clipper2/clipper.export.h b/CPP/Clipper2Lib/include/clipper2/clipper.export.h index 4649700e..3dfd2618 100644 --- a/CPP/Clipper2Lib/include/clipper2/clipper.export.h +++ b/CPP/Clipper2Lib/include/clipper2/clipper.export.h @@ -155,9 +155,7 @@ inline Rect CRectToRect(const CRect& rect) template inline T1 Reinterpret(T2 value) { - T1 result; - memcpy(&result, &value, sizeof(value)); - return result; + return *reinterpret_cast(&value); } @@ -317,7 +315,7 @@ static T* CreateCPathsFromPathsT(const Paths& paths) *v++ = pt.x; *v++ = pt.y; #ifdef USINGZ - *v++ = Reinterpret(pt.z); + *v++ = Reinterpret(pt.z); #endif } } @@ -342,7 +340,7 @@ CPathsD CreateCPathsDFromPathsD(const PathsD& paths) *v++ = pt.x; *v++ = pt.y; #ifdef USINGZ - * v++ = Reinterpret(pt.z); + * v++ = Reinterpret(pt.z); #endif } } @@ -367,7 +365,7 @@ CPathsD CreateCPathsDFromPaths64(const Paths64& paths, double scale) *v++ = pt.x * scale; *v++ = pt.y * scale; #ifdef USINGZ - *v++ = Reinterpret(pt.z); + *v++ = Reinterpret(pt.z); #endif } } @@ -387,7 +385,7 @@ static Path ConvertCPathToPathT(T* path) { T x = *v++, y = *v++; #ifdef USINGZ - z_type z = Reinterpret(*v++); + z_type z = Reinterpret(*v++); result.push_back(Point(x, y, z)); #else result.push_back(Point(x, y)); @@ -414,7 +412,7 @@ static Paths ConvertCPathsToPathsT(T* paths) { T x = *v++, y = *v++; #ifdef USINGZ - z_type z = Reinterpret(*v++); + z_type z = Reinterpret(*v++); path.push_back(Point(x, y, z)); #else path.push_back(Point(x, y)); @@ -438,7 +436,7 @@ static Path64 ConvertCPathDToPath64WithScale(const CPathD path, double scale) double x = *v++ * scale; double y = *v++ * scale; #ifdef USINGZ - z_type z = Reinterpret(*v++); + z_type z = Reinterpret(*v++); result.push_back(Point64(x, y, z)); #else result.push_back(Point64(x, y)); @@ -466,7 +464,7 @@ static Paths64 ConvertCPathsDToPaths64(const CPathsD paths, double scale) double x = *v++ * scale; double y = *v++ * scale; #ifdef USINGZ - z_type z = Reinterpret(*v++); + z_type z = Reinterpret(*v++); path.push_back(Point64(x, y, z)); #else path.push_back(Point64(x, y)); @@ -486,7 +484,7 @@ static void CreateCPolyPath64(const PolyPath64* pp, int64_t*& v) *v++ = pt.x; *v++ = pt.y; #ifdef USINGZ - * v++ = Reinterpret(pt.z); // raw memory copy + * v++ = Reinterpret(pt.z); // raw memory copy #endif } for (size_t i = 0; i < pp->Count(); ++i) @@ -502,7 +500,7 @@ static void CreateCPolyPathD(const PolyPathD* pp, double*& v) *v++ = pt.x; *v++ = pt.y; #ifdef USINGZ - * v++ = Reinterpret(pt.z); // raw memory copy + * v++ = Reinterpret(pt.z); // raw memory copy #endif } for (size_t i = 0; i < pp->Count(); ++i)