Skip to content

Commit

Permalink
clang
Browse files Browse the repository at this point in the history
  • Loading branch information
bassmang committed Oct 13, 2023
1 parent 7c42c29 commit ab4aab1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

#include <cstddef>
#include <functional>
#include <memory>
#include <map>
#include <memory>

namespace VW
{
Expand Down
22 changes: 11 additions & 11 deletions vowpalwabbit/core/src/array_parameters_sparse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ VW::weight* VW::sparse_parameters::get_or_default_and_get(size_t i) const
return iter->second.get();
}

VW::weight* VW::sparse_parameters::get_impl(size_t i) const {
static VW::weight default_value = 0.0f;
VW::weight* VW::sparse_parameters::get_impl(size_t i) const
{
static VW::weight default_value = 0.0f;

uint64_t index = i & _weight_mask;
auto iter = _map.find(index);
if (iter == _map.end()) {
if (_default_func != nullptr) {
_default_func(&default_value, index);
}
return &default_value;
}
uint64_t index = i & _weight_mask;
auto iter = _map.find(index);
if (iter == _map.end())
{
if (_default_func != nullptr) { _default_func(&default_value, index); }
return &default_value;
}

return iter->second.get();
return iter->second.get();
}

VW::sparse_parameters::sparse_parameters(size_t length, uint32_t stride_shift)
Expand Down

0 comments on commit ab4aab1

Please sign in to comment.