From 9d48bd87420901fab3030478b0f39ae17367625f Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Sat, 26 Dec 2020 11:38:29 -0300 Subject: [PATCH] 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38737 Tested-by: kokoro Reviewed-by: Jason Lowe-Power Maintainer: Bobby R. Bruce --- src/base/flags.hh | 2 +- src/base/flags.test.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/base/flags.hh b/src/base/flags.hh index 6e8221004..0544380f1 100644 --- a/src/base/flags.hh +++ b/src/base/flags.hh @@ -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); } diff --git a/src/base/flags.test.cc b/src/base/flags.test.cc index c45a7a89d..08031b9b7 100644 --- a/src/base/flags.test.cc +++ b/src/base/flags.test.cc @@ -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 flags(value_a); - flags.update(value_b, mask); + flags.replace(value_b, mask); ASSERT_EQ(result, uint32_t(flags)); } -- 2.30.2