Switching to [KMGTPE]i prefixes?

Xin LI delphij at gmail.com
Fri Mar 25 21:56:40 UTC 2011


FYI I have a patch and I have incorporated some of Alexander's idea.

Difference:

 - Use of both HN_DIVISOR_1000 and HN_IEC_PREFIXES triggers an
assertion.  I think it doesn't make sense to return since this is an
API violation and we should just tell the caller explicitly;
 - DIVISOR_1000 and !1000 cases use just same prefixes, so merge them
while keeping divisor intact;
 - Make prefixes table consistently long.  I have no strong opinion on
this one, though, it's just what my original version used and I can
change it to the way Alexander did if there is an advantage of doing
that way.

(Note, it seems that we use HN_ prefix for both 'scale' and 'flags', I
have sorted them by value but HN_IEC_PREFIXES should really belong to
the flags group).

Cheers,
-- 
Xin LI <delphij at delphij.net> http://www.delphij.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: humanize_number.c.diff
Type: text/x-patch
Size: 1879 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110325/c8e2f42d/humanize_number.c.bin


More information about the freebsd-hackers mailing list