From 8383b7e2edeb8a2a4501a2c53d97a0f791f1a71c Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 17 Feb 2015 16:24:49 +1100 Subject: [PATCH] region: offset max region's base stops signed types from only covering negative coordinate regions --- region.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/region.cpp b/region.cpp index 86778a63..893786ff 100644 --- a/region.cpp +++ b/region.cpp @@ -326,12 +326,18 @@ namespace util { ///---------------------------------------------------------------------------- -/// The largest specifiable finite region. Specifically does not allow infinities. +/// The largest specifiable finite region. +/// +/// Starts at half the minimum value to allow the width to cover some positive +/// range rather than just cancelling out the lowest value for signed types. +/// +/// Specifically does not allow infinities. Use/define INFINITE when required. + template const util::region util::region::MAX ( - std::numeric_limits::lowest (), - std::numeric_limits::lowest (), + std::numeric_limits::lowest () / 2, + std::numeric_limits::lowest () / 2, std::numeric_limits::max (), std::numeric_limits::max () );