Skip to content

Commit

Permalink
test Clang-Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmcfarlane authored and John McFarlane committed May 30, 2022
1 parent acdc54b commit 0cfab84
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/unit/zero_cost_square.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ auto square_scaled_integer(float input)
auto square_elastic(float input)
{
// alias to scaled_integer<elastic_integer<31, int>, -16>
auto fixed = elastic_scaled_integer<15, power<-16>>{input};
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
auto fixed = new elastic_scaled_integer<15, power<-16>>{input};

// concise, safe and zero-cost!
auto prod = fixed * fixed;
auto prod = *fixed * *fixed;

if (input > 42) {
// NOLINTNEXTLINE(cppcoreguidelines-owning-memory)
delete fixed;
}

return static_cast<float>(prod);
}

0 comments on commit 0cfab84

Please sign in to comment.