Re: + fls-change-parameter-to-unsigned-int.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 06, 2018 at 07:44:37AM -0800, Matthew Wilcox wrote:
> On Tue, Nov 06, 2018 at 06:14:44PM +0300, Alexey Dobriyan wrote:
> > On Mon, Nov 05, 2018 at 03:33:01PM -0800, akpm@xxxxxxxxxxxxxxxxxxxx wrote:
> > 
> > > -static inline int fls(int x)
> > > +static inline int fls(unsigned int x)
> > >  {
> > > -	return fls64((unsigned int) x);
> > > +	return fls64(x);
> > >  }
> > 
> > Should it return "unsigned"? Logically it should.
> > I remember doing this and there was some code size increase :-(
> 
> Yes, it returns a number in the range [0-32], so it can absolutely
> be unsigned.  I'm kind of surprised it made any difference.
> 
> When you say "doing this", what did you try?  unsigned fls(unsigned),
> int fls(unsigned) or unsigned fls(int) ?

I did "unsigned fls()" with and without

	if (rv > 32)
		__builtin_unreachable();

but I didn't send anything because there was something erratic with code
generation.



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux