Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1572748

Re: [PATCH] log2: make order_base_2() behave correctly on const input value zero

From Ard Biesheuvel <ard.biesheuvel@linaro.org>
Newsgroups linux.kernel
Subject Re: [PATCH] log2: make order_base_2() behave correctly on const input value zero
Date 2017-02-02 22:00 +0100
Message-ID <t6wE2-ua-9@gated-at.bofh.it> (permalink)
References <t6t3r-6OU-17@gated-at.bofh.it> <t6wum-qe-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> On 2 Feb 2017, at 20:49, Linus Torvalds <torvalds@linux-foundation.org> wrote:
> 
> On Thu, Feb 2, 2017 at 9:04 AM, Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
>> 
>> So update order_base_2() to adhere to its own documented interface.
> 
> Ok, looks like you screwed up the types according to the build server.
> 
> Making the return type "unsigned long" is slightly excessive. If you
> need an unsigned long to describe the log2 of a number in the kernel,
> you're playing with numbers that are *way* too big.
> 
> The old code used "ilog2()", which returns an int.
> 

Yeah I cloned roundup_pow_of_2, and failed to spot that ilog2 returns an int. I sent out the v2 already

> Which is plenty big enough of a type.
> 
>                Linus

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] log2: make order_base_2() behave correctly on const input value zero Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-02-02 18:10 +0100
  Re: [PATCH] log2: make order_base_2() behave correctly on const  input value zero kbuild test robot <lkp@intel.com> - 2017-02-02 19:00 +0100
  Re: [PATCH] log2: make order_base_2() behave correctly on const input  value zero Linus Torvalds <torvalds@linux-foundation.org> - 2017-02-02 21:50 +0100
    Re: [PATCH] log2: make order_base_2() behave correctly on const input value zero Ard Biesheuvel <ard.biesheuvel@linaro.org> - 2017-02-02 22:00 +0100

csiph-web