Skip to content

Commit cebee6e

Browse files
committed
Fix g++6 compile error
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); ```
1 parent 93bd824 commit cebee6e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/db/db_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,8 +2234,8 @@ uint64_t micros() {
22342234
}
22352235

22362236
void print_timer_info(std::string msg, uint64_t a, uint64_t b) {
2237-
uint64_t diff = abs(a-b);
2238-
printf("%s: %lu micros (%f ms)\n", msg.c_str(), diff, diff/1000.0);
2237+
uint64_t diff = a > b ? a - b : b - a;
2238+
printf("%s: %llu micros (%f ms)\n", msg.c_str(), diff, diff/1000.0);
22392239
}
22402240

22412241
void print_divider() {

0 commit comments

Comments
 (0)