base: Rename Flags::update as Flags::replace

The function name `update` is too generic. Given that
the expected functionality is to replace the selected
flag bits with the bits provided as parameters, rename
it as `replace`.

Change-Id: Ic7613ae09ecf9b92e31103b4e928192c07e9b640
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38737
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
This commit is contained in:
Daniel R. Carvalho
2020-12-26 11:38:29 -03:00
committed by Daniel Carvalho
parent 2aa5fb0d63
commit 9d48bd8742
2 changed files with 4 additions and 4 deletions

View File

@@ -135,7 +135,7 @@ class Flags
* @param mask Mask used to determine which bits are replaced.
*/
void
update(Type flags, Type mask)
replace(Type flags, Type mask)
{
_flags = (_flags & ~mask) | (flags & mask);
}

View File

@@ -192,11 +192,11 @@ TEST(FlagsTest, ConditionalSet)
}
/**
* Test updating a masked selection of bits. This means that bits of the
* Test replacing a masked selection of bits. This means that bits of the
* original value that match the mask will be replaced by the bits of
* the new value that match the mask.
*/
TEST(FlagsTest, UpdateOverlapping)
TEST(FlagsTest, ReplaceOverlapping)
{
const uint32_t value_a = (1 << 4) | (1 << 5) | (1 << 6);
const uint32_t value_b = (1 << 3) | (1 << 5) | (1 << 9);
@@ -207,6 +207,6 @@ TEST(FlagsTest, UpdateOverlapping)
// (1 << 10) is not set in both values, so it remains not set
const uint32_t result = (1 << 5) | (1 << 6) | (1 << 9);
Flags<uint32_t> flags(value_a);
flags.update(value_b, mask);
flags.replace(value_b, mask);
ASSERT_EQ(result, uint32_t(flags));
}