From 892012dc02d13229e88db1809f7b785fc3516787 Mon Sep 17 00:00:00 2001 From: Tillmann Karras Date: Thu, 27 Feb 2014 21:04:41 +0100 Subject: [PATCH] Remove own round() implementation 1. It's not correct, it rounds x.5 down to x. 2. It is visible across the whole project (!). 3. VS2013 finally supports this: http://msdn.microsoft.com/en-us/library/dn353646.aspx http://msdn.microsoft.com/en-us/library/dn329049.aspx --- Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp index ee5a59ddd8..1056adb412 100644 --- a/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/WiimoteEmu.cpp @@ -23,10 +23,6 @@ #include "Core/HW/WiimoteEmu/Attachment/Turntable.h" #include "Core/HW/WiimoteReal/WiimoteReal.h" -#ifdef _WIN32 -inline double round(double x) { return (x-floor(x))>0.5 ? ceil(x) : floor(x); } //because damn MSVSC doesen't comply to C99 -#endif - namespace { // :) @@ -524,8 +520,8 @@ void Wiimote::GetIRData(u8* const data, bool use_accel) MatrixTransformVertex(tot,v[i]); if ((v[i].x<-1)||(v[i].x>1)||(v[i].y<-1)||(v[i].y>1)) continue; - x[i]=(u16)round((v[i].x+1)/2*(camWidth-1)); - y[i]=(u16)round((v[i].y+1)/2*(camHeight-1)); + x[i] = (u16)lround((v[i].x+1)/2*(camWidth-1)); + y[i] = (u16)lround((v[i].y+1)/2*(camHeight-1)); } // PanicAlert("%f %f\n%f %f\n%f %f\n%f %f\n%d %d\n%d %d\n%d %d\n%d %d", // v[0].x,v[0].y,v[1].x,v[1].y,v[2].x,v[2].y,v[3].x,v[3].y,