From ab673c0a27509796189ab3ac089c7d0489e68af9 Mon Sep 17 00:00:00 2001 From: cryptokat Date: Fri, 18 Jan 2019 10:32:35 +0800 Subject: [PATCH] Fix g++6 compile error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this error would be emitted when compiling with g++6 ``` /pebblesdb/src/db/db_test.cc: In function ‘void leveldb::print_timer_info(std::__cxx11::string, uint64_t, uint64_t)’: /pebblesdb/src/db/db_test.cc:2237:25: error: call of overloaded ‘abs(uint64_t)’ is ambiguous uint64_t diff = abs(a-b); ``` --- src/db/db_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db/db_test.cc b/src/db/db_test.cc index 01ccd66..5438252 100644 --- a/src/db/db_test.cc +++ b/src/db/db_test.cc @@ -2234,7 +2234,7 @@ uint64_t micros() { } void print_timer_info(std::string msg, uint64_t a, uint64_t b) { - uint64_t diff = abs(a-b); + uint64_t diff = a > b ? a - b : b - a; printf("%s: %lu micros (%f ms)\n", msg.c_str(), diff, diff/1000.0); }