| 80 | //! Scalar encoding a single value with ALP |
| 81 | template <bool SAFE = true> |
| 82 | static ST encode_value(const PT value, const factor_idx_t factor_idx, const exponent_idx_t exponent_idx) { |
| 83 | PT tmp_encoded_value = value * Constants<PT>::EXP_ARR[exponent_idx] * Constants<PT>::FRAC_ARR[factor_idx]; |
| 84 | if constexpr (SAFE) { |
| 85 | if (is_impossible_to_encode(tmp_encoded_value)) { return ENCODING_UPPER_LIMIT; } |
| 86 | } |
| 87 | tmp_encoded_value = tmp_encoded_value + Constants<PT>::MAGIC_NUMBER - Constants<PT>::MAGIC_NUMBER; |
| 88 | return static_cast<ST>(tmp_encoded_value); |
| 89 | } |
| 90 | |
| 91 | template <typename UT> |
| 92 | static uint8_t count_bits(UT x) { |
nothing calls this directly
no outgoing calls
no test coverage detected