base: Fix undefined behavior in mask generation
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Thu, 26 Mar 2020 10:29:11 +0000 (11:29 +0100)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Fri, 3 Apr 2020 23:13:25 +0000 (23:13 +0000)
commitffad8a370aa29e69f4e8984e5daff76d22b06cce
tree0482787e919ce49f3a12791cd9afd7392f4c9498
parent64134b6e66b93082a67e45a403129353d4012d30
base: Fix undefined behavior in mask generation

When generating a mask, if the number of bits is greater than
the maximum shift distance (63), the shift will have undefined
behavior. Previously the branch was taking care of a single
trespassing case, and it has been fixed to cover the remaining.

Issue-on: https://gem5.atlassian.net/browse/GEM5-205

Change-Id: Ib5a00917c8d2b23ffdb710c2f9673d956cd9f43e
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27104
Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
src/base/bitfield.hh