[llvm-commits] [llvm] r106033 - /llvm/trunk/lib/Support/FileUtilities.cpp

Daniel Dunbar daniel at zuster.org
Tue Jun 15 12:20:30 PDT 2010


Author: ddunbar
Date: Tue Jun 15 14:20:30 2010
New Revision: 106033

URL: http://llvm.org/viewvc/llvm-project?rev=106033&view=rev
Log:
fpcmp: Fix bug where fpcmp wouldn't early exit when files obviously differ and
no tolerance is set.

Modified:
    llvm/trunk/lib/Support/FileUtilities.cpp

Modified: llvm/trunk/lib/Support/FileUtilities.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/FileUtilities.cpp?rev=106033&r1=106032&r2=106033&view=diff
==============================================================================
--- llvm/trunk/lib/Support/FileUtilities.cpp (original)
+++ llvm/trunk/lib/Support/FileUtilities.cpp Tue Jun 15 14:20:30 2010
@@ -212,16 +212,16 @@
   const char *F1P = File1Start;
   const char *F2P = File2Start;
 
-  if (A_size == B_size) {
-    // Are the buffers identical?  Common case: Handle this efficiently.
-    if (std::memcmp(File1Start, File2Start, A_size) == 0)
-      return 0;
-
-    if (AbsTol == 0 && RelTol == 0) {
-      if (Error)
-        *Error = "Files differ without tolerance allowance";
-      return 1;   // Files different!
-    }
+  // Are the buffers identical?  Common case: Handle this efficiently.
+  if (A_size == B_size &&
+      std::memcmp(File1Start, File2Start, A_size) == 0)
+    return 0;
+
+  // Otherwise, we are done a tolerances are set.
+  if (AbsTol == 0 && RelTol == 0) {
+    if (Error)
+      *Error = "Files differ without tolerance allowance";
+    return 1;   // Files different!
   }
 
   bool CompareFailed = false;





More information about the llvm-commits mailing list