Fix two warnings in bench timers.
authorbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 3 Oct 2011 20:44:39 +0000 (20:44 +0000)
committerbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Mon, 3 Oct 2011 20:44:39 +0000 (20:44 +0000)
http://codereview.appspot.com/5164049/

git-svn-id: http://skia.googlecode.com/svn/trunk@2400 2bbb7eff-a529-9590-31e7-b0007b416f81

bench/BenchSysTimer_windows.cpp
bench/BenchSysTimer_windows.h

index 103d1b5..e51d346 100644 (file)
@@ -42,7 +42,7 @@ void BenchSysTimer::startCpu() {
 
 double BenchSysTimer::endCpu() {
     ULONGLONG end_cpu = winCpuTime();
-    return (end_cpu - this->fStartCpu) / 10000;
+    return static_cast<double>((end_cpu - this->fStartCpu)) / 10000.0L;
 }
 double BenchSysTimer::endWall() {
     LARGE_INTEGER end_wall;
@@ -55,8 +55,9 @@ double BenchSysTimer::endWall() {
     
     LARGE_INTEGER frequency;
     if (0 == ::QueryPerformanceFrequency(&frequency)) {
-        return 0;
+        return 0.0L;
     } else {
-        return (double)ticks_elapsed.QuadPart / frequency.QuadPart * 1000;
+        return static_cast<double>(ticks_elapsed.QuadPart)
+            /  static_cast<double>(frequency.QuadPart * 1000);
     }
 }
index b0f016a..c3d0c9b 100644 (file)
@@ -12,7 +12,7 @@
 #define WIN32_LEAN_AND_MEAN 1
 #include <Windows.h>
 
-struct BenchSysTimer {
+class BenchSysTimer {
 public:
     void startWall();
     void startCpu();