public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: David Howells <dhowells@redhat.com>
Cc: torvalds@osdl.org, akpm@osdl.org, benh@kernel.crashing.org,
	linux-kernel@vger.kernel.org, johannes@sipsolutions.net
Subject: Re: [PATCH] Fix get_order() [try #2]
Date: Tue, 06 Mar 2007 10:51:27 -0800	[thread overview]
Message-ID: <45EDB82F.8030803@zytor.com> (raw)
In-Reply-To: <11476.1173206866@redhat.com>

David Howells wrote:
> H. Peter Anvin <hpa@zytor.com> wrote:
> 
>> Why not just make it ((n) < 1 ? 0 : ...) and make it well-defined for
>> n == 0?
> 
> Because log2(0) is -INF or mathematically undefined or something isn't it?

Yes, but it's a *rounding up* function.  In this case, it makes sense to 
round up 0 to 1.  This is, in fact, a common way to handle requests for 
zero-byte allocation in order to be able to return a unique address for 
each one, so it's not a spurious thing.

	-hpa

  reply	other threads:[~2007-03-06 18:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-06 18:34 [PATCH] Fix get_order() [try #2] David Howells
2007-03-06 18:37 ` H. Peter Anvin
2007-03-06 18:41   ` David Howells
2007-03-06 18:39 ` H. Peter Anvin
2007-03-06 18:47   ` David Howells
2007-03-06 18:51     ` H. Peter Anvin [this message]
2007-03-06 19:42 ` Alexey Dobriyan
2007-03-06 20:01   ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45EDB82F.8030803@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=dhowells@redhat.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox