Remove getBitfieldCount method
Remove the getBitfieldCount method and use the C++20 feature
`std::popcount` to get the number of bits of 1.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I71a5c1a9e10f508ce58a01ec8dc17ed5d96ed8a5
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index 893cc83..779a0cd 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -615,7 +615,7 @@
}
// 0x01 to 0x08
- uint8_t sensorRearmCount = getBitfieldCount(sensorRearm);
+ uint8_t sensorRearmCount = std::popcount(sensorRearm.byte);
std::vector<get_sensor_state_field> stateField(sensorRearmCount);
uint8_t comSensorCnt{};
const pldm::utils::DBusHandler dBusIntf;