- char postfix[] = { ' ', 'K', 'M', 'G', 'P', 'E' };
- unsigned int thousand[] = { 1000, 1024 };
- unsigned int modulo, decimals;
- int post_index;
- char tmp[32], fmt[8];
+ const char *sistr[] = { "", "k", "M", "G", "T", "P" };
+ const char *iecstr[] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" };
+ const char **unitprefix;
+ static const char *const unitstr[] = {
+ [N2S_NONE] = "",
+ [N2S_PERSEC] = "/s",
+ [N2S_BYTE] = "B",
+ [N2S_BIT] = "bit",
+ [N2S_BYTEPERSEC]= "B/s",
+ [N2S_BITPERSEC] = "bit/s"
+ };
+ const unsigned int thousand[] = { 1000, 1024 };
+ unsigned int modulo;
+ int post_index, carry = 0;
+ char tmp[32], fmt[32];