Adding a way for log-format numbers to become more human readable.
[rsync/rsync.git] / inums.h
1 /* Inline functions for rsync.
2  *
3  * Copyright (C) 2008 Wayne Davison
4  *
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.
9  *
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.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, visit the http://fsf.org website.
17  */
18
19 static inline char *
20 big_num(int64 num)
21 {
22         return do_big_num(num, 0, NULL);
23 }
24
25 static inline char *
26 comma_num(int64 num)
27 {
28         extern int human_readable;
29         return do_big_num(num, human_readable != 0, NULL);
30 }
31
32 static inline char *
33 human_num(int64 num)
34 {
35         extern int human_readable;
36         return do_big_num(num, human_readable, NULL);
37 }
38
39 static inline char *
40 big_dnum(double dnum, int decimal_digits)
41 {
42         return do_big_dnum(dnum, 0, decimal_digits);
43 }
44
45 static inline char *
46 comma_dnum(double dnum, int decimal_digits)
47 {
48         extern int human_readable;
49         return do_big_dnum(dnum, human_readable != 0, decimal_digits);
50 }
51
52 static inline char *
53 human_dnum(double dnum, int decimal_digits)
54 {
55         extern int human_readable;
56         return do_big_dnum(dnum, human_readable, decimal_digits);
57 }