# | Line 69 | Line 69 | stats_t stats; | |
---|---|---|
69 | char *size_conv(long long number){ | |
70 | char type[] = {'B', 'K', 'M', 'G', 'T'}; | |
71 | int x=0; | |
72 | + | int sign=1; |
73 | static char string[10]; | |
74 | ||
75 | + | if(number < 0){ |
76 | + | sign=-1; |
77 | + | number=-number; |
78 | + | } |
79 | + | |
80 | for(;x<5;x++){ | |
81 | if( (number/1024) < (100)) { | |
82 | break; | |
# | Line 78 | Line 84 | char *size_conv(long long number){ | |
84 | number = (number/1024); | |
85 | } | |
86 | ||
87 | < | snprintf(string, 10, "%lld%c", number, type[x]); |
87 | > | number = number*sign; |
88 | > | |
89 | > | snprintf(string, 10, "%lld%c", number, type[x]); |
90 | return string; | |
91 | ||
92 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |