Skip to content

Commit

Permalink
cycleclock: Fix type conversion to match function return type on riscv64
Browse files Browse the repository at this point in the history
Fixes builds with clang

src/cycleclock.h:213:10: error: implicit conversion changes signedness: 'uint64_t' (aka 'unsigned long') to 'int64_t' (aka 'long') [-Werror,-Wsign-conversion]
     213 |   return cycles;
         |   ~~~~~~ ^~~~~~
   1 error generated.

Signed-off-by: Khem Raj <raj.khem@gmail.com>
  • Loading branch information
kraj committed Jun 11, 2024
1 parent 2fa4b26 commit 54bca09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/cycleclock.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ inline BENCHMARK_ALWAYS_INLINE int64_t Now() {
#else
uint64_t cycles;
asm volatile("rdtime %0" : "=r"(cycles));
return cycles;
return static_cast<int64_t>(cycles);
#endif
#elif defined(__e2k__) || defined(__elbrus__)
struct timeval tv;
Expand Down

0 comments on commit 54bca09

Please sign in to comment.