diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-06-15 19:20:30 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-15 19:20:30 +0000 |
commit | e22295e8a660b99674556e2eaceb0a02b37fdf79 (patch) | |
tree | 92379a9fd0cb1673e6bdac67ec10a1d8d8fa5d9c /llvm/lib/Support/FileUtilities.cpp | |
parent | b645fa13a919d93798e2aa8b4fb8cc38c7d24012 (diff) | |
download | bcm5719-llvm-e22295e8a660b99674556e2eaceb0a02b37fdf79.tar.gz bcm5719-llvm-e22295e8a660b99674556e2eaceb0a02b37fdf79.zip |
fpcmp: Fix bug where fpcmp wouldn't early exit when files obviously differ and
no tolerance is set.
llvm-svn: 106033
Diffstat (limited to 'llvm/lib/Support/FileUtilities.cpp')
-rw-r--r-- | llvm/lib/Support/FileUtilities.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Support/FileUtilities.cpp b/llvm/lib/Support/FileUtilities.cpp index 11c1e02abab..1bde2fe8a87 100644 --- a/llvm/lib/Support/FileUtilities.cpp +++ b/llvm/lib/Support/FileUtilities.cpp @@ -212,16 +212,16 @@ int llvm::DiffFilesWithTolerance(const sys::PathWithStatus &FileA, 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; + // Are the buffers identical? Common case: Handle this efficiently. + if (A_size == B_size && + 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! - } + // 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; |