summaryrefslogtreecommitdiff
path: root/zen/basic_math.h
diff options
context:
space:
mode:
authorDaniel Wilhelm <daniel@wili.li>2014-04-18 17:27:42 +0200
committerDaniel Wilhelm <daniel@wili.li>2014-04-18 17:27:42 +0200
commitb916407a2a06f8452e82b74dc44c54acbcc572b0 (patch)
tree46358e0bb035fca0f42edb4b5b8aa5f1613814af /zen/basic_math.h
parent5.20 (diff)
downloadFreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.tar.gz
FreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.tar.bz2
FreeFileSync-b916407a2a06f8452e82b74dc44c54acbcc572b0.zip
5.21
Diffstat (limited to 'zen/basic_math.h')
-rw-r--r--zen/basic_math.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/zen/basic_math.h b/zen/basic_math.h
index 05d892ee..56cfd923 100644
--- a/zen/basic_math.h
+++ b/zen/basic_math.h
@@ -228,6 +228,8 @@ bool isNull(T value)
inline
int round(double d)
{
+ assert(d - 0.5 >= std::numeric_limits<int>::min() && //if double is larger than what int can represent:
+ d + 0.5 <= std::numeric_limits<int>::max()); //=> undefined behavior!
return static_cast<int>(d < 0 ? d - 0.5 : d + 0.5);
}
bgstack15