42 if (o ==
"OUTPUT_FIX")
44 else if (o ==
"OUTPUT_FIX_SHIFT")
46 else if (o ==
"OUTPUT_FLOAT")
48 else if (o ==
"OUTPUT_FLOAT_SHIFT")
51 it_error(
"Fix_Base::set_output_mode: Illegal output mode!");
56 std::cout <<
"shift = " <<
shift << std::endl
57 <<
"wordlen = " <<
wordlen << std::endl
58 <<
"int(emode) = " << int(
emode) << std::endl
59 <<
"int(omode) = " << int(
omode) << std::endl
60 <<
"int(qmode) = " << int(
qmode) << std::endl
61 <<
"stat_ptr = " <<
stat_ptr << std::endl
62 <<
"min = " <<
min << std::endl
63 <<
"max = " <<
max << std::endl
81 it_error(
"Fix_Base::init: Illegal sign encoding mode!");
91 bool overflow =
false;
103 it_error(
"Fix_Base::apply_o_mode: Illegal overflow mode!");
107 else if (ret >
max) {
117 it_error(
"Fix_Base::apply_o_mode: Illegal overflow mode!");
154 if (scaled_value ==
std::floor(scaled_value) + 0.5)
160 if (scaled_value ==
std::floor(scaled_value) + 0.5)
161 if (scaled_value < 0)
175 it_error(
"Fix_Base::scale_and_apply_modes: Illegal quantization mode!");
184 it_assert_debug(n >= 0,
"Fix_Base::rshift_and_apply_q_mode: n cannot be negative!");
194 ret = ((x >> (n - 1)) + 1) >> 1;
200 if ((x & (
fixrep(1) << (n - 1))) && ((x < 0) || (x & ((
fixrep(1) << (n - 1)) - 1))))
209 if ((x & (
fixrep(1) << (n - 1))) && (x & ((
fixrep(1) << (n - 1)) - 1)))
218 if ((x & (
fixrep(1) << (n - 1))) && ((x >= 0) || (x & ((
fixrep(1) << (n - 1)) - 1))))
227 if ((x & (
fixrep(1) << (n - 1))) && ((x & (
fixrep(1) << n)) || (x & ((
fixrep(1) << (n - 1)) - 1))))
236 if ((x & (
fixrep(1) << (n - 1))) && (!(x & (
fixrep(1) << n)) || (x & ((
fixrep(1) << (n - 1)) - 1))))
249 if ((x < 0) && (x & ((
fixrep(1) << n) - 1)))
255 it_error(
"Fix_Base::rshift_and_apply_q_mode: Illegal quantization mode!");