Fixed Vojtech's out of boundary assert in Clipper library.

This commit is contained in:
Vojtech Bubnik 2023-10-03 14:36:32 +02:00
parent 5b45777d4b
commit 0a202dcff3

View File

@ -97,7 +97,8 @@ inline IType Round(double val)
{
double v = FRound(val);
#if defined(CLIPPERLIB_INT32) && ! defined(NDEBUG)
static constexpr const double hi = 65536 * 16383;
static_assert(sizeof(IType) == 4 || sizeof(IType) == 8, "IType must be int32 or int64");
static constexpr const double hi = 65536. * 16383. * (sizeof(IType) == 4 ? 1 : 65536. * 65536.);
if (v > hi || -v > hi)
throw clipperException("Coordinate outside allowed range");
#endif