From: Daniel Sommermann Date: Fri, 17 Oct 2014 20:38:00 +0000 (-0700) Subject: Fix -Wsign-compare X-Git-Tag: v0.22.0~221 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3d420c103bff021931d82fc12612a9935873938d;p=folly.git Fix -Wsign-compare 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 --- diff --git a/folly/Benchmark.h b/folly/Benchmark.h index 3460a79d..41d13384 100644 --- a/folly/Benchmark.h +++ b/folly/Benchmark.h @@ -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::max() / 1000000000UL); return (end.tv_sec - start.tv_sec) * 1000000000UL + end.tv_nsec - start.tv_nsec;