 	
 	float bestError = FLT_MAX;
 	
-    for(int i = 0; i < 16; i++)
-    {
+	for(int i = 0; i < 16; i++)
+	{
 		int pidx = idx + NUM_THREADS * i;
 		if (pidx >= 992) break;
-        
-        ushort start, end;
-        uint permutation = permutations[pidx];
-
-        float error = evalPermutation4(colors, weights, colorSum, permutation, &start, &end);
-        
-        if (error < bestError)
-        {
-            bestError = error;
-            bestPermutation = permutation;
-            bestStart = start;
-            bestEnd = end;
-        }
-    }
-
-    if (bestStart < bestEnd)
-    {
-        swap(bestEnd, bestStart);
-        bestPermutation ^= 0x55555555;    // Flip indices.
-    }
+		
+		ushort start, end;
+		uint permutation = permutations[pidx];
+
+		float error = evalPermutation4(colors, weights, colorSum, permutation, &start, &end);
+		
+		if (error < bestError)
+		{
+			bestError = error;
+			bestPermutation = permutation;
+			bestStart = start;
+			bestEnd = end;
+		}
+	}
+
+	if (bestStart < bestEnd)
+	{
+		swap(bestEnd, bestStart);
+		bestPermutation ^= 0x55555555;	// Flip indices.
+	}
 
 	errors[idx] = bestError;
 }


inline __device__ uchar roundAndExpand(float a)
{
    return rintf(__saturatef(a) * 255.0f);
}
*/
/*

////////////////////////////////////////////////////////////////////////////////
inline __device__ float3 roundAndExpand(float3 v, ushort * w)
{
	v.x = rintf(__saturatef(v.x) * 31.0f);
	v.y = rintf(__saturatef(v.y) * 63.0f);
	v.z = rintf(__saturatef(v.z) * 31.0f);
	*w = ((ushort)v.x << 11) | ((ushort)v.y << 5) | (ushort)v.z;
	v.x *= 0.03227752766457f; // approximate integer bit expansion.
	v.y *= 0.01583151765563f;
	v.z *= 0.03227752766457f;
	return v;
}


