Fix -Wsign-compare
authorDaniel Sommermann <dcsommer@fb.com>
Fri, 17 Oct 2014 20:38:00 +0000 (13:38 -0700)
committerPavlo Kushnir <pavlo@fb.com>
Sat, 8 Nov 2014 02:10:44 +0000 (18:10 -0800)
Summary:
Fixed unsigned/signed compares.

I had to suppress the warning in one place, but don't worry, clang
supports `#pragma GCC diagnostic ...` (see http://clang.llvm.org/docs/UsersManual.html#controlling-diagnostics-via-pragmas)

Test Plan: unit tests

Reviewed By: afrind@fb.com

Subscribers: alandau, mshneer, trunkagent, doug, jdperlow, bmatheny, njormrod, cgheorghe, folly-diffs@

FB internal diff: D1624249

Tasks: 5140804

Signature: t1:1624249:1414620209:5399e8d90d8ca32b30794a7b2a4a7c2d7d437dda

folly/Benchmark.h

index 3460a79d3f656a00ca4811e24cfc028fc49fc2ca..41d133849297bff5f55d03ead610ca1dfd489e5c 100644 (file)
@@ -76,7 +76,7 @@ inline uint64_t timespecDiff(timespec end, timespec start) {
     return end.tv_nsec - start.tv_nsec;
   }
   assert(end.tv_sec > start.tv_sec &&
-         end.tv_sec - start.tv_sec <
+         (uint64_t)(end.tv_sec - start.tv_sec) <
          std::numeric_limits<uint64_t>::max() / 1000000000UL);
   return (end.tv_sec - start.tv_sec) * 1000000000UL
     + end.tv_nsec - start.tv_nsec;