lkml.org 
[lkml]   [2007]   [Mar]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Fix get_order() [try #2]
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-03-06 19:57    [W:0.071 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site