diff options
author | Wolfgang Denk <wd@denx.de> | 2008-11-25 11:40:57 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-11-25 11:40:57 +0100 |
commit | f9b354faa0417b7f8888de246ff5f267f7cb17f2 (patch) | |
tree | a156a4a36cd4bf7da3108839053af45e1a4da5b4 /lib_generic/vsprintf.c | |
parent | c49dc0b3b8f0fc9ed8e50d17d20e8e65d7abae57 (diff) | |
parent | 25ea652e907516a283b38237e83712a918f125d7 (diff) | |
download | u-boot-imx-f9b354faa0417b7f8888de246ff5f267f7cb17f2.zip u-boot-imx-f9b354faa0417b7f8888de246ff5f267f7cb17f2.tar.gz u-boot-imx-f9b354faa0417b7f8888de246ff5f267f7cb17f2.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-ubi
Diffstat (limited to 'lib_generic/vsprintf.c')
-rw-r--r-- | lib_generic/vsprintf.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib_generic/vsprintf.c b/lib_generic/vsprintf.c index 6e903db..767dde1 100644 --- a/lib_generic/vsprintf.c +++ b/lib_generic/vsprintf.c @@ -55,6 +55,29 @@ long simple_strtol(const char *cp,char **endp,unsigned int base) return simple_strtoul(cp,endp,base); } +int ustrtoul(const char *cp, char **endp, unsigned int base) +{ + unsigned long result = simple_strtoul(cp, endp, base); + switch (**endp) { + case 'G' : + result *= 1024; + /* fall through */ + case 'M': + result *= 1024; + /* fall through */ + case 'K': + case 'k': + result *= 1024; + if ((*endp)[1] == 'i') { + if ((*endp)[2] == 'B') + (*endp) += 3; + else + (*endp) += 2; + } + } + return result; +} + #ifdef CONFIG_SYS_64BIT_STRTOUL unsigned long long simple_strtoull (const char *cp, char **endp, unsigned int base) { |