accumulator: add noexcept where reasonable
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
surtur 2022-01-29 23:54:26 +01:00
parent 74f8af7bfc
commit df4c9d7bdb
Signed by: wanderer
GPG Key ID: 19CE1EC1D9E0486D
2 changed files with 12 additions and 13 deletions

View File

@ -29,17 +29,17 @@ Accumulator::Accumulator() noexcept {
Accumulator::~Accumulator() noexcept {}
auto Accumulator::set_reseed_ctr_to_null() -> void {
auto Accumulator::set_reseed_ctr_to_null() noexcept -> void {
std::lock_guard<std::mutex> lg(mtx);
this->reseed_ctr = 0x00;
}
auto Accumulator::incr_reseed_ctr() -> void {
auto Accumulator::incr_reseed_ctr() noexcept -> void {
std::lock_guard<std::mutex> lg(mtx);
{ ++this->reseed_ctr; }
}
auto Accumulator::get_reseed_ctr() const -> uint64_t {
auto Accumulator::get_reseed_ctr() const noexcept -> uint64_t {
std::lock_guard<std::mutex> lg(mtx);
return this->reseed_ctr;
}
@ -54,7 +54,7 @@ auto Accumulator::_p_pools_equal(
}
// check if given source id is an id of an already registered entropy source
auto Accumulator::src_is_registered(const uint8_t& id) -> bool {
auto Accumulator::src_is_registered(const uint8_t& id) noexcept -> bool {
std::atomic<bool> reg{false};
static uint8_t _src_id{};
@ -77,7 +77,7 @@ auto Accumulator::src_is_registered(const uint8_t& id) -> bool {
auto Accumulator::set_pools_ptr(
std::shared_ptr<std::array<accumulator::Pool, Accumulator::NUM_OF_POOLS>>
p_pools) -> void {
p_pools) noexcept -> void {
this->_p_pools = p_pools;
}

View File

@ -37,11 +37,11 @@ protected:
public:
constexpr static const unsigned int init_pool_num{0};
auto set_reseed_ctr_to_null() -> void;
auto set_reseed_ctr_to_null() noexcept -> void;
auto incr_reseed_ctr() -> void;
auto incr_reseed_ctr() noexcept -> void;
auto get_reseed_ctr() const -> uint64_t;
auto get_reseed_ctr() const noexcept -> uint64_t;
auto _p_pools_equal(
std::shared_ptr<std::array<accumulator::Pool,
@ -65,12 +65,11 @@ public:
}
}
[[maybe_unused]] auto src_is_registered(const uint8_t& id) -> bool;
[[maybe_unused]] auto src_is_registered(const uint8_t& id) noexcept -> bool;
auto set_pools_ptr(
std::shared_ptr<
std::array<accumulator::Pool, Accumulator::NUM_OF_POOLS>> p_pools)
-> void;
auto set_pools_ptr(std::shared_ptr<
std::array<accumulator::Pool, Accumulator::NUM_OF_POOLS>>
p_pools) noexcept -> void;
auto set_gen(fortuna::generator::Generator& Gen) -> void;