chore(event_adder_impl): reuse constant p_size
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
size of pools array will stay the same anyway
This commit is contained in:
parent
c401a47ca7
commit
82288fe20d
|
@ -9,22 +9,22 @@ namespace accumulator {
|
||||||
|
|
||||||
class EventAdderImpl final : public EventAdder {
|
class EventAdderImpl final : public EventAdder {
|
||||||
private:
|
private:
|
||||||
|
static constexpr const uint8_t p_size{32};
|
||||||
int pool;
|
int pool;
|
||||||
static unsigned int source_id;
|
static unsigned int source_id;
|
||||||
static accumulator::Pool pools[32];
|
static accumulator::Pool pools[p_size];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EventAdderImpl(const unsigned int source_id, const accumulator::Pool pools[32]) {
|
EventAdderImpl(const unsigned int source_id, const accumulator::Pool pools[32]) {
|
||||||
this->source_id = source_id;
|
this->source_id = source_id;
|
||||||
static constexpr const uint64_t pools_size{pools.size()};
|
for (unsigned int i = 0; i < this->p_size; i++) {
|
||||||
for (unsigned int i = 0; i < pools_size; i++) {
|
|
||||||
this->pools[i] = pools[i];
|
this->pools[i] = pools[i];
|
||||||
}
|
}
|
||||||
this->pool = 0;
|
this->pool = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void add(std::vector<char> event) override {
|
void add(std::vector<char> event) override {
|
||||||
this->pool = (this->pool + 1) % pools.size();
|
this->pool = (this->pool + 1) % p_size;
|
||||||
pools[this->pool].add_entropy(source_id, event);
|
pools[this->pool].add_entropy(source_id, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue