Skip to content

Commit

Permalink
make to_float(level) handle invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Oct 21, 2024
1 parent 7804baa commit 39f6470
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/osr/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ constexpr level_t to_level(float const f) {
}

constexpr float to_float(level_t const l) {
return kMinLevel + (to_idx(l) / 4.0F);
return l == level_t::invalid() ? 0.0F : (kMinLevel + (to_idx(l) / 4.0F));
}

constexpr auto const kLevelBits = cista::constexpr_trailing_zeros(
Expand Down

0 comments on commit 39f6470

Please sign in to comment.