git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fix potential infinite loop given large unsigned integer

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 10, 2009, 12:24 UTC
Message-ID
<alpine.DEB.1.00.0908101421340.8324@intel-tinevez-2-302>
In-Reply-To
<40aa078e0908100412l3c2afd1bnda9b10aaf1de383f@mail.gmail.com>
Hi,
On Mon, 10 Aug 2009, Erik Faye-Lund wrote:
Show 9 quoted lines
> On Mon, Aug 10, 2009 at 7:24 AM, Christian
> Couder<chriscool@tuxfamily.org> wrote:
> >> log10() appears to be C99, but can be emulated on earlier C-versions by
> >> doing #define log10(x) (log(x) / log(10.0))
> >
> > That would mean linking with -lm?
> 
> I guess so. Are we currently trying to avoid linking to the math-parts 
> of libc?
Yes.
I guess we could fix the overflow thing very easily, though:
static unsigned int digits_of_number(unsigned int number) {
	unsigned int result;
	for (result = 1; number; number /= 10, result++)
		; /* do nothing */
	return result;
}

Ciao, Dscho

Previous: Erik Faye-LundNext: Ryan Flynn
Message 7 of 14 in “fix potential infinite loop given large unsigned integer”
  1. fix potential infinite loop given large unsigned integerRyan Flynn, Aug 9, 2009
  2. Junio C HamanoAug 9, 2009
  3. Junio C HamanoAug 9, 2009
  4. Erik Faye-LundAug 9, 2009
  5. Christian CouderAug 10, 2009
  6. Erik Faye-LundAug 10, 2009
  7. Johannes SchindelinAug 10, 2009
  8. Ryan FlynnAug 10, 2009
  9. Ryan FlynnAug 10, 2009
  10. Johannes SchindelinAug 10, 2009
  11. Jeff EplerAug 11, 2009
  12. Ryan FlynnAug 10, 2009
  13. Tony FinchAug 10, 2009
  14. Ryan FlynnAug 9, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.