Skip to content

Commit 5c96b89

Browse files
authored
Preparing to merge export_usingz branch (AngusJohnson#878)
* Branch from main - to test USINGZ in clipper.export.h * clipper.header.h - Replaced problematic bit_cast function * clipper.export.h - tweaked new Reinterpret function * Tweaked a C++ CI test routine * clipper.export.h - minor tweak to Reinterpret function * tweaks to CI config. * another tweak to C++ CI configuration
1 parent c19da72 commit 5c96b89

35 files changed

+4256
-1605
lines changed

.github/workflows/actions_cpp.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ jobs:
66
windows-latest:
77
runs-on: 'windows-latest'
88
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/setup-node@v2
9+
- uses: actions/checkout@v4
10+
- uses: actions/setup-node@v4
1111
with:
1212
node-version: '16'
1313
- name: Add MSBuild to PATH
14-
uses: microsoft/setup-msbuild@v1.0.2
14+
uses: microsoft/setup-msbuild@v2
1515
- name: Build
1616
run: |
1717
mkdir CPP/build
@@ -25,8 +25,8 @@ jobs:
2525
ubuntu-latest-gcc-default:
2626
runs-on: 'ubuntu-latest'
2727
steps:
28-
- uses: actions/checkout@v2
29-
- uses: actions/setup-node@v2
28+
- uses: actions/checkout@v4
29+
- uses: actions/setup-node@v4
3030
with:
3131
node-version: '16'
3232
- name: Build
@@ -42,8 +42,8 @@ jobs:
4242
ubuntu-latest-gcc-11:
4343
runs-on: 'ubuntu-latest'
4444
steps:
45-
- uses: actions/checkout@v2
46-
- uses: actions/setup-node@v2
45+
- uses: actions/checkout@v4
46+
- uses: actions/setup-node@v4
4747
with:
4848
node-version: '16'
4949
- name: Install gcc 11
@@ -64,8 +64,8 @@ jobs:
6464
ubuntu-latest-clang-default:
6565
runs-on: 'ubuntu-latest'
6666
steps:
67-
- uses: actions/checkout@v2
68-
- uses: actions/setup-node@v2
67+
- uses: actions/checkout@v4
68+
- uses: actions/setup-node@v4
6969
with:
7070
node-version: '16'
7171
- name: Build
@@ -83,8 +83,8 @@ jobs:
8383
ubuntu-latest-clang-13:
8484
runs-on: 'ubuntu-latest'
8585
steps:
86-
- uses: actions/checkout@v2
87-
- uses: actions/setup-node@v2
86+
- uses: actions/checkout@v4
87+
- uses: actions/setup-node@v4
8888
with:
8989
node-version: '16'
9090
- name: Install clang 13
@@ -107,8 +107,8 @@ jobs:
107107
macos-latest:
108108
runs-on: 'macos-latest'
109109
steps:
110-
- uses: actions/checkout@v2
111-
- uses: actions/setup-node@v2
110+
- uses: actions/checkout@v4
111+
- uses: actions/setup-node@v4
112112
with:
113113
node-version: '16'
114114
- name: Build

.github/workflows/actions_csharp.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
run:
1010
working-directory: ./CSharp
1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v4
1313
- name: Copy Clipper2Lib to USINGZ directory
1414
run: cp Clipper2Lib/*.cs USINGZ/
1515
- name: Setup .NET Core

CPP/Clipper2Lib/include/clipper2/clipper.core.h

+9-5
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,21 @@ namespace Clipper2Lib
107107
//https://en.wikipedia.org/wiki/Nonzero-rule
108108
enum class FillRule { EvenOdd, NonZero, Positive, Negative };
109109

110+
#ifdef USINGZ
111+
using z_type = int64_t;
112+
#endif
113+
110114
// Point ------------------------------------------------------------------------
111115

112116
template <typename T>
113117
struct Point {
114118
T x;
115119
T y;
116120
#ifdef USINGZ
117-
int64_t z;
121+
z_type z;
118122

119123
template <typename T2>
120-
inline void Init(const T2 x_ = 0, const T2 y_ = 0, const int64_t z_ = 0)
124+
inline void Init(const T2 x_ = 0, const T2 y_ = 0, const z_type z_ = 0)
121125
{
122126
if constexpr (std::is_integral_v<T> &&
123127
is_round_invocable<T2>::value && !std::is_integral_v<T2>)
@@ -137,7 +141,7 @@ namespace Clipper2Lib
137141
explicit Point() : x(0), y(0), z(0) {};
138142

139143
template <typename T2>
140-
Point(const T2 x_, const T2 y_, const int64_t z_ = 0)
144+
Point(const T2 x_, const T2 y_, const z_type z_ = 0)
141145
{
142146
Init(x_, y_);
143147
z = z_;
@@ -150,7 +154,7 @@ namespace Clipper2Lib
150154
}
151155

152156
template <typename T2>
153-
explicit Point(const Point<T2>& p, int64_t z_)
157+
explicit Point(const Point<T2>& p, z_type z_)
154158
{
155159
Init(p.x, p.y, z_);
156160
}
@@ -160,7 +164,7 @@ namespace Clipper2Lib
160164
return Point(x * scale, y * scale, z);
161165
}
162166

163-
void SetZ(const int64_t z_value) { z = z_value; }
167+
void SetZ(const z_type z_value) { z = z_value; }
164168

165169
friend std::ostream& operator<<(std::ostream& os, const Point& point)
166170
{

0 commit comments

Comments
 (0)