mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-13 13:27:14 +02:00
Utility function to get a vector of set bits
Template function to return a vector with the positions of all set bits in a variable.
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
#include "CmdProxy.h"
|
||||
#include "bit_utils.h"
|
||||
#include "TimeHelper.h"
|
||||
#include "ToString.h"
|
||||
#include "container_utils.h"
|
||||
@ -1810,14 +1811,7 @@ std::string CmdProxy::Counters(int action) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto mask = det->getCounterMask({det_id}).squash(-1);
|
||||
// scan counter enable mask to get vector
|
||||
std::vector<int> result;
|
||||
for (size_t i = 0; i < 32; ++i) {
|
||||
if (mask & (1 << i)) {
|
||||
result.push_back(static_cast<int>(i));
|
||||
}
|
||||
}
|
||||
os << sls::ToString(result) << '\n';
|
||||
os << sls::ToString(getSetBits(mask)) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.empty()) {
|
||||
WrongNumberOfParameters(1);
|
||||
|
Reference in New Issue
Block a user