3 * Copyright 2008 Free Software Foundation, Inc.
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 print_uint64(uint64_t u)
26 const char *_hex = "0123456789ABCDEF";
33 print_thousandths(int thousandths)
36 if (thousandths < 100)
40 printf("%d", thousandths);
45 print_fxpt_freq(u2_fxpt_freq_t v)
52 int64_t int_part = v >> 20;
53 int32_t frac_part = v & ((1 << 20) - 1);
56 // would work, if we had it
57 printf("%lld.%03d", int_part, (frac_part * 1000) >> 20);
59 print_uint64(int_part);
60 print_thousandths((frac_part * 1000) >> 20);
65 print_fxpt_gain(u2_fxpt_gain_t v)
72 int32_t int_part = v >> 7;
73 int32_t frac_part = v & ((1 << 7) - 1);
76 // would work, if we had it
77 printf("%d.%03d", int_part, (frac_part * 1000) >> 7);
79 printf("%d", int_part);
80 print_thousandths((frac_part * 1000) >> 7);