summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorAndrea Mondelli <Andrea.Mondelli@ucf.edu>2019-03-14 18:20:54 -0400
committerAndrea Mondelli <Andrea.Mondelli@ucf.edu>2019-04-01 15:55:58 +0000
commit283e092eda0b739a3c28bfa6293822e57ca67db6 (patch)
treeba58ed333e5a365e76518aad47a2568d5409d070 /src/base
parent2a98a994df296f818b05da90ba073d879562da04 (diff)
downloadgem5-283e092eda0b739a3c28bfa6293822e57ca67db6.tar.xz
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 <giacomo.travaglini@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/base')
-rw-r--r--src/base/bitfield.hh2
1 files changed, 1 insertions, 1 deletions
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<T>(val >> 8)) {
output = (output << 8) | reverseLookUpTable[val & 0xFF];
}