11#include "../utility/utility.hpp"
12#include "../macros.hpp"
18hi_export_module(hikogui.image.snorm_r8);
20hi_export
namespace hi::inline
v1 {
22[[nodiscard]]
constexpr int8_t make_snorm_r8_value(
float rhs)
noexcept
24 return round_cast<int8_t>(
std::round(std::clamp(rhs, -1.0f, 1.0f) * 127.0f));
41 explicit snorm_r8(
float rhs) noexcept : value(make_snorm_r8_value(rhs)) {}
43 snorm_r8 &operator=(
float rhs)
noexcept
45 value = make_snorm_r8_value(rhs);
49 explicit operator float()
const noexcept
51 return narrow_cast<float>(value) / 127.0f;
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
1 x int8_t pixel format.
Definition snorm_r8.hpp:31