cleanup formating (e.g. no trailing spaces)



git-svn-id: http://skia.googlecode.com/svn/trunk@143 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index 38c3dc1..dddd2da 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -6,13 +6,13 @@
 static int symmetric_fixmul(int a, int b) {
     int sa = SkExtractSign(a);
     int sb = SkExtractSign(b);
-    
+
     a = SkApplySign(a, sa);
     b = SkApplySign(b, sb);
-    
+
 #if 1
     int c = (int)(((SkLONGLONG)a * b) >> 16);
-    
+
     return SkApplySign(c, sa ^ sb);
 #else
     SkLONGLONG ab = (SkLONGLONG)a * b;
@@ -30,9 +30,9 @@
     float x = SkScalarToFloat(p.fX);
     float y = SkScalarToFloat(p.fY);
     float len = sk_float_sqrt(x*x + y*y);
-    
+
     len /= SkScalarToFloat(targetLen);
-    
+
     REPORTER_ASSERT(reporter, len > 0.999f && len < 1.001f);
 #endif
 }
@@ -114,25 +114,24 @@
 static void unittest_fastfloat(skiatest::Reporter* reporter) {
     SkRandom rand;
     size_t i;
-    
+
     static const float gFloats[] = {
         0.f, 1.f, 0.5f, 0.499999f, 0.5000001f, 1.f/3,
         0.000000001f, 1000000000.f,     // doesn't overflow
         0.0000000001f, 10000000000.f    // does overflow
     };
     for (i = 0; i < SK_ARRAY_COUNT(gFloats); i++) {
-        //        SkDebugf("---- test floats %g %d\n", gFloats[i], (int)gFloats[i]);
         test_float_conversions(reporter, gFloats[i]);
         test_float_conversions(reporter, -gFloats[i]);
     }
-    
+
     for (int outer = 0; outer < 100; outer++) {
         rand.setSeed(outer);
         for (i = 0; i < 100000; i++) {
             float x = nextFloat(rand);
             test_float_conversions(reporter, x);
         }
-        
+
         test_int2float(reporter, 0);
         test_int2float(reporter, 1);
         test_int2float(reporter, -1);
@@ -156,13 +155,13 @@
             float s = ab / 255.0f;
             int round = (int)floorf(s + 0.5f);
             int trunc = (int)floorf(s);
-            
+
             int iround = SkMulDiv255Round(a, b);
             int itrunc = SkMulDiv255Trunc(a, b);
-            
+
             REPORTER_ASSERT(reporter, iround == round);
             REPORTER_ASSERT(reporter, itrunc == trunc);
-            
+
             REPORTER_ASSERT(reporter, itrunc <= iround);
             REPORTER_ASSERT(reporter, iround <= a);
             REPORTER_ASSERT(reporter, iround <= b);
@@ -171,23 +170,23 @@
 #endif
 }
 
-static void TestMath(skiatest::Reporter* reporter) {    
+static void TestMath(skiatest::Reporter* reporter) {
     int         i;
     int32_t     x;
     SkRandom    rand;
-    
+
     // these should assert
 #if 0
     SkToS8(128);
     SkToS8(-129);
     SkToU8(256);
     SkToU8(-5);
-    
+
     SkToS16(32768);
     SkToS16(-32769);
     SkToU16(65536);
     SkToU16(-5);
-    
+
     if (sizeof(size_t) > 4) {
         SkToS32(4*1024*1024);
         SkToS32(-4*1024*1024);
@@ -195,77 +194,77 @@
         SkToU32(-5);
     }
 #endif
-    
+
     test_muldiv255(reporter);
-    
+
     {
         SkScalar x = SK_ScalarNaN;
         REPORTER_ASSERT(reporter, SkScalarIsNaN(x));
     }
-    
+
     for (i = 1; i <= 10; i++) {
         x = SkCubeRootBits(i*i*i, 11);
         REPORTER_ASSERT(reporter, x == i);
     }
-    
+
     x = SkFixedSqrt(SK_Fixed1);
     REPORTER_ASSERT(reporter, x == SK_Fixed1);
     x = SkFixedSqrt(SK_Fixed1/4);
     REPORTER_ASSERT(reporter, x == SK_Fixed1/2);
     x = SkFixedSqrt(SK_Fixed1*4);
     REPORTER_ASSERT(reporter, x == SK_Fixed1*2);
-    
+
     x = SkFractSqrt(SK_Fract1);
     REPORTER_ASSERT(reporter, x == SK_Fract1);
     x = SkFractSqrt(SK_Fract1/4);
     REPORTER_ASSERT(reporter, x == SK_Fract1/2);
     x = SkFractSqrt(SK_Fract1/16);
     REPORTER_ASSERT(reporter, x == SK_Fract1/4);
-    
+
     for (i = 1; i < 100; i++) {
         x = SkFixedSqrt(SK_Fixed1 * i * i);
         REPORTER_ASSERT(reporter, x == SK_Fixed1 * i);
     }
-    
+
     for (i = 0; i < 1000; i++) {
         int value = rand.nextS16();
         int max = rand.nextU16();
-        
+
         int clamp = SkClampMax(value, max);
         int clamp2 = value < 0 ? 0 : (value > max ? max : value);
         REPORTER_ASSERT(reporter, clamp == clamp2);
     }
-    
+
     for (i = 0; i < 100000; i++) {
         SkPoint p;
-        
+
         p.setLength(rand.nextS(), rand.nextS(), SK_Scalar1);
         check_length(reporter, p, SK_Scalar1);
         p.setLength(rand.nextS() >> 13, rand.nextS() >> 13, SK_Scalar1);
         check_length(reporter, p, SK_Scalar1);
     }
-    
+
     {
         SkFixed result = SkFixedDiv(100, 100);
         REPORTER_ASSERT(reporter, result == SK_Fixed1);
         result = SkFixedDiv(1, SK_Fixed1);
         REPORTER_ASSERT(reporter, result == 1);
     }
-    
+
 #ifdef SK_CAN_USE_FLOAT
     unittest_fastfloat(reporter);
 #endif
-    
+
 #ifdef SkLONGLONG
     for (i = 0; i < 100000; i++) {
         SkFixed numer = rand.nextS();
         SkFixed denom = rand.nextS();
         SkFixed result = SkFixedDiv(numer, denom);
         SkLONGLONG check = ((SkLONGLONG)numer << 16) / denom;
-        
+
         (void)SkCLZ(numer);
         (void)SkCLZ(denom);
-        
+
         REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32);
         if (check > SK_MaxS32) {
             check = SK_MaxS32;
@@ -273,10 +272,10 @@
             check = SK_MinS32;
         }
         REPORTER_ASSERT(reporter, result == (int32_t)check);
-        
+
         result = SkFractDiv(numer, denom);
         check = ((SkLONGLONG)numer << 30) / denom;
-        
+
         REPORTER_ASSERT(reporter, result != (SkFixed)SK_NaN32);
         if (check > SK_MaxS32) {
             check = SK_MaxS32;
@@ -284,61 +283,65 @@
             check = SK_MinS32;
         }
         REPORTER_ASSERT(reporter, result == (int32_t)check);
-        
+
         // make them <= 2^24, so we don't overflow in fixmul
         numer = numer << 8 >> 8;
         denom = denom << 8 >> 8;
-        
+
         result = SkFixedMul(numer, denom);
         SkFixed r2 = symmetric_fixmul(numer, denom);
         //        SkASSERT(result == r2);
-        
+
         result = SkFixedMul(numer, numer);
         r2 = SkFixedSquare(numer);
         REPORTER_ASSERT(reporter, result == r2);
-        
+
 #ifdef SK_CAN_USE_FLOAT
         if (numer >= 0 && denom >= 0) {
             SkFixed mean = SkFixedMean(numer, denom);
-            float fm = sk_float_sqrt(sk_float_abs(SkFixedToFloat(numer) * SkFixedToFloat(denom)));
+            float prod = SkFixedToFloat(numer) * SkFixedToFloat(denom);
+            float fm = sk_float_sqrt(sk_float_abs(prod));
             SkFixed mean2 = SkFloatToFixed(fm);
             int diff = SkAbs32(mean - mean2);
             REPORTER_ASSERT(reporter, diff <= 1);
         }
-        
+
         {
             SkFixed mod = SkFixedMod(numer, denom);
             float n = SkFixedToFloat(numer);
             float d = SkFixedToFloat(denom);
             float m = sk_float_mod(n, d);
-            REPORTER_ASSERT(reporter, mod == 0 || (mod < 0) == (m < 0)); // ensure the same sign
+            // ensure the same sign
+            REPORTER_ASSERT(reporter, mod == 0 || (mod < 0) == (m < 0));
             int diff = SkAbs32(mod - SkFloatToFixed(m));
             REPORTER_ASSERT(reporter, (diff >> 7) == 0);
         }
 #endif
     }
 #endif
-    
+
 #ifdef SK_CAN_USE_FLOAT
     for (i = 0; i < 100000; i++) {
         SkFract x = rand.nextU() >> 1;
         double xx = (double)x / SK_Fract1;
         SkFract xr = SkFractSqrt(x);
         SkFract check = SkFloatToFract(sqrt(xx));
-        REPORTER_ASSERT(reporter, xr == check || xr == check-1 || xr == check+1);
-        
+        REPORTER_ASSERT(reporter, xr == check ||
+                                  xr == check-1 ||
+                                  xr == check+1);
+
         xr = SkFixedSqrt(x);
         xx = (double)x / SK_Fixed1;
         check = SkFloatToFixed(sqrt(xx));
         REPORTER_ASSERT(reporter, xr == check || xr == check-1);
-        
+
         xr = SkSqrt32(x);
         xx = (double)x;
         check = (int32_t)sqrt(xx);
         REPORTER_ASSERT(reporter, xr == check || xr == check-1);
     }
 #endif
-    
+
 #if !defined(SK_SCALAR_IS_FLOAT) && defined(SK_CAN_USE_FLOAT)
     {
         SkFixed s, c;
@@ -346,21 +349,21 @@
         REPORTER_ASSERT(reporter, s == 0);
         REPORTER_ASSERT(reporter, c == SK_Fixed1);
     }
-    
+
     int maxDiff = 0;
     for (i = 0; i < 10000; i++) {
         SkFixed rads = rand.nextS() >> 10;
         double frads = SkFixedToFloat(rads);
-        
+
         SkFixed s, c;
         s = SkScalarSinCos(rads, &c);
-        
+
         double fs = sin(frads);
         double fc = cos(frads);
-        
+
         SkFixed is = SkFloatToFixed(fs);
         SkFixed ic = SkFloatToFixed(fc);
-        
+
         maxDiff = SkMax32(maxDiff, SkAbs32(is - s));
         maxDiff = SkMax32(maxDiff, SkAbs32(ic - c));
     }