6#include <AH/STL/type_traits>
12template <
size_t Bits_out,
size_t Bits_in,
class T_out,
class T_in>
13std::enable_if_t<(Bits_out <= 2 * Bits_in), T_out>
15 constexpr size_t leftShift = Bits_out - Bits_in;
16 constexpr size_t rightShift = Bits_in - leftShift;
17 return (T_out(in) << leftShift) | (in >> rightShift);
20template <
size_t Bits_out,
size_t Bits_in,
class T_out,
class T_in>
21std::enable_if_t<(Bits_out > 2 * Bits_in), T_out>
23 constexpr size_t leftShift = Bits_out - Bits_in;
24 return (T_out(in) << leftShift) |
25 increaseBitDepthImpl<leftShift, Bits_in, T_out>(in);
63template <
size_t Bits_out,
size_t Bits_in,
class T_out,
class T_in>
65 static_assert(Bits_in <=
sizeof(T_in) * CHAR_BIT,
66 "Error: Bits_in > bits(T_in)");
67 static_assert(Bits_out <=
sizeof(T_out) * CHAR_BIT,
68 "Error: Bits_out > bits(T_out)");
69 return increaseBitDepthImpl<Bits_out, Bits_in, T_out>(in);
std::enable_if_t<(Bits_out<=2 *Bits_in), T_out > increaseBitDepthImpl(T_in in)
#define BEGIN_AH_NAMESPACE
#define AH_DIAGNOSTIC_POP()
#define AH_DIAGNOSTIC_WERROR()
T_out increaseBitDepth(T_in in)
Increase the bit depth of the given value from Bits_in bits wide to Bits_out bits wide,...