dev: Fix std::min type mismatch in reg_bank.hh

https://github.com/gem5/gem5/pull/386 included two cases in
"src/dev/reg_bank.hh" where `std:: min` was used to compare a an integer
of type `size_t` and another of type `Addr`. This cause an error on my
Apple Silicon Mac as this is a comparison between an "unsigned long"
and an "unsigned long long" which (at least on my setup) was not
permitted. To fix this issue the `reg_size` was changed from `size_t` to
`Addr`, as well as it the types of the values it was derived from and
the variable used to hold the return from the `std::min` calls.

Change-Id: I31e9c04a8e0327d4f6f5390bc5a743c629db4746
This commit is contained in:
Bobby R. Bruce
2023-11-20 16:04:13 -08:00
parent 3896673ddc
commit 08c0d1f27a

View File

@@ -979,9 +979,9 @@ class RegisterBank : public RegisterBankBase
std::ostringstream ss;
while (done != bytes) {
RegisterBase &reg = it->second.get();
const size_t reg_off = addr - it->first;
const size_t reg_size = reg.size() - reg_off;
const size_t reg_bytes = std::min(reg_size, bytes - done);
const Addr reg_off = addr - it->first;
const Addr reg_size = reg.size() - reg_off;
const Addr reg_bytes = std::min(reg_size, bytes - done);
if (reg_bytes != reg.size()) {
if (_debug_flag) {
@@ -1025,9 +1025,9 @@ class RegisterBank : public RegisterBankBase
std::ostringstream ss;
while (done != bytes) {
RegisterBase &reg = it->second.get();
const size_t reg_off = addr - it->first;
const size_t reg_size = reg.size() - reg_off;
const size_t reg_bytes = std::min(reg_size, bytes - done);
const Addr reg_off = addr - it->first;
const Addr reg_size = reg.size() - reg_off;
const Addr reg_bytes = std::min(reg_size, bytes - done);
if (reg_bytes != reg.size()) {
if (_debug_flag) {