From d94aaf1fcf01abeb3c205a4ad42417d6d80fdf22 Mon Sep 17 00:00:00 2001 From: Braden Obrzut Date: Mon, 18 Jan 2016 16:03:37 -0500 Subject: [PATCH] - Fixed: Undefined negative double to unsigned int conversion in FNodeBuilder::PointToAngle. --- src/nodebuild_utility.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nodebuild_utility.cpp b/src/nodebuild_utility.cpp index 14ab7be58..5eba8b7be 100644 --- a/src/nodebuild_utility.cpp +++ b/src/nodebuild_utility.cpp @@ -76,7 +76,8 @@ angle_t FNodeBuilder::PointToAngle (fixed_t x, fixed_t y) #else // !__APPLE__ || __llvm__ double ang = atan2 (double(y), double(x)); #endif // __APPLE__ && !__llvm__ - return angle_t(ang * rad2bam) << 1; + // Convert to signed first since negative double to unsigned is undefined. + return angle_t(int(ang * rad2bam)) << 1; } void FNodeBuilder::FindUsedVertices (vertex_t *oldverts, int max)