From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <46CB10DD.4090005@freescale.com> Date: Tue, 21 Aug 2007 11:20:45 -0500 From: Scott Wood MIME-Version: 1.0 To: David Gibson Subject: Re: [PATCH 14/20] bootwrapper: Add strtoull(). References: <20070820173920.GA30546@ld0162-tx32.am.freescale.net> <20070820174004.GM30562@ld0162-tx32.am.freescale.net> <20070821024713.GM15469@localhost.localdomain> In-Reply-To: <20070821024713.GM15469@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Cc: linuxppc-dev@ozlabs.org, paulus@samba.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , David Gibson wrote: >>+/* Not currently supported: leading whitespace, sign, 0x prefix, zero base */ >>+unsigned long long int strtoull(const char *ptr, char **end, int base) >>+{ >>+ unsigned long long ret = 0; >>+ >>+ while (*ptr) { >>+ int digit; >>+ >>+ if (*ptr >= '0' && *ptr <= '9') >>+ digit = *ptr - '0'; >>+ else if (*ptr >= 'A' && *ptr <= 'Z') >>+ digit = *ptr - 'A' + 10; >>+ else if (*ptr >= 'a' && *ptr <= 'z') >>+ digit = *ptr - 'a' + 10; >>+ else >>+ break; > > > Hrm... I note this has no sort of error checking if the string has > digits which don't fit in the given base. Oops. I'll fix that. -Scott