Skip to content

Commit

Permalink
games: is_constant_evaluated replaced with consteval in varooom 3d
Browse files Browse the repository at this point in the history
  • Loading branch information
GValiente committed Aug 23, 2024
1 parent 3834fd9 commit ebf4baf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 10 additions & 2 deletions games/varooom-3d/include/fr_div_lut.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ template<int Precision>
{
static_assert(Precision > 0 && Precision <= div_lut_precision, "Invalid precision");

uint32_t div_lut_value = bn::is_constant_evaluated() ?
calculate_div_lut_value(denominator) : div_lut_ptr[denominator];
uint32_t div_lut_value = 0;

if consteval
{
div_lut_value = calculate_div_lut_value(denominator);
}
else
{
div_lut_value = div_lut_ptr[denominator];
}

return bn::fixed_t<Precision>::from_data(numerator * int(div_lut_value >> (div_lut_precision - Precision)));
}
Expand Down
3 changes: 1 addition & 2 deletions games/varooom-3d/include/fr_sin_cos.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include "bn_fixed.h"
#include "bn_sin_lut.h"
#include "bn_type_traits.h"

namespace fr
{
Expand All @@ -17,7 +16,7 @@ extern const int16_t* sin_lut_ptr;

[[nodiscard]] constexpr bn::fixed sin(int angle)
{
if(bn::is_constant_evaluated())
if consteval
{
return bn::fixed::from_data(bn::calculate_sin_lut_value(angle));
}
Expand Down

0 comments on commit ebf4baf

Please sign in to comment.