From 283e092eda0b739a3c28bfa6293822e57ca67db6 Mon Sep 17 00:00:00 2001 From: Andrea Mondelli Date: Thu, 14 Mar 2019 18:20:54 -0400 Subject: dev-arm: Correct cast of template parameter Clang with -Wconstant-conversion is _very_ restrictive on casting. The shift operator results in an incorrect promotion. This patch add a compile-time static cast that remove the error when clang is used. Change-Id: I3aa1e77da2565799feadc32317d5faa111b2de86 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17308 Reviewed-by: Giacomo Travaglini Maintainer: Andreas Sandberg --- src/base/bitfield.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/base') diff --git a/src/base/bitfield.hh b/src/base/bitfield.hh index d696715b3..ec1ffce50 100644 --- a/src/base/bitfield.hh +++ b/src/base/bitfield.hh @@ -182,7 +182,7 @@ reverseBits(T val, std::size_t size = sizeof(T)) assert(size <= sizeof(T)); T output = 0; - for (auto byte = 0; byte < size; byte++, val >>= 8) { + for (auto byte = 0; byte < size; byte++, val = static_cast(val >> 8)) { output = (output << 8) | reverseLookUpTable[val & 0xFF]; } -- cgit v1.2.3