From 69f5d5589f2cba365c4f7f4647e6244e48e3c597 Mon Sep 17 00:00:00 2001 From: Juha Reunanen Date: Sun, 12 May 2024 10:39:23 +0300 Subject: [PATCH] Add helpful remark --- CPP/Clipper2Lib/include/clipper2/clipper.core.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CPP/Clipper2Lib/include/clipper2/clipper.core.h b/CPP/Clipper2Lib/include/clipper2/clipper.core.h index dc2a1641..098c49c7 100644 --- a/CPP/Clipper2Lib/include/clipper2/clipper.core.h +++ b/CPP/Clipper2Lib/include/clipper2/clipper.core.h @@ -681,7 +681,9 @@ namespace Clipper2Lib // returns true if (and only if) a * b == c * d inline bool ProductsAreEqual(int64_t a, int64_t b, int64_t c, int64_t d) { - // nb: unsigned values will be needed for CalcOverflowCarry() + // nb: unsigned values will be needed for CalcOverflowCarry(), and also + // for the straightforward multiplication itself because signed + // arithmetic overflow is undefined behavior const auto abs_a = static_cast(std::abs(a)); const auto abs_b = static_cast(std::abs(b)); const auto abs_c = static_cast(std::abs(c));