logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

expand_number — format a number from human readable form

Description

The expand_number() function unformats the buf string and stores a unsigned 64-bit quantity at address pointed out by the num argument. The expand_number() function follows the SI power of two convention. The prefixes are: PrefixDescriptionMultiplierk kilo 1024 M mega 1048576 G giga 1073741824 T tera 1099511627776 P peta 1125899906842624 E exa 1152921504606846976

Errors

The expand_number() function will fail if: [EINVAL] The given string contains no digits. [EINVAL] An unrecognized prefix was given. [ERANGE] Result doesn't fit into 64 bits.

History

The expand_number() function first appeared in FreeBSD 6.3. Debian August 15, 2010 expand_number(3bsd)

Library

Utility functions from BSD systems (libbsd, -lbsd)

Name

expand_number — format a number from human readable form

Return Values

Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.

See Also

humanize_number(3bsd)

Synopsis

#include<libutil.h> (See libbsd(7) for include usage.) intexpand_number(constchar*buf, uint64_t*num);

See Also