* Re: + fls-change-parameter-to-unsigned-int.patch added to -mm tree [not found] <20181105233301.KlgdF%akpm@linux-foundation.org> @ 2018-11-06 15:14 ` Alexey Dobriyan 2018-11-06 15:44 ` Matthew Wilcox 0 siblings, 1 reply; 3+ messages in thread From: Alexey Dobriyan @ 2018-11-06 15:14 UTC (permalink / raw) To: willy; +Cc: linux-kernel, tglx, linux-arch On Mon, Nov 05, 2018 at 03:33:01PM -0800, akpm@linux-foundation.org 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 :-( ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: + fls-change-parameter-to-unsigned-int.patch added to -mm tree 2018-11-06 15:14 ` + fls-change-parameter-to-unsigned-int.patch added to -mm tree Alexey Dobriyan @ 2018-11-06 15:44 ` Matthew Wilcox 2018-11-06 17:01 ` Alexey Dobriyan 0 siblings, 1 reply; 3+ messages in thread From: Matthew Wilcox @ 2018-11-06 15:44 UTC (permalink / raw) To: Alexey Dobriyan; +Cc: linux-kernel, tglx, linux-arch On Tue, Nov 06, 2018 at 06:14:44PM +0300, Alexey Dobriyan wrote: > On Mon, Nov 05, 2018 at 03:33:01PM -0800, akpm@linux-foundation.org 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) ? ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: + fls-change-parameter-to-unsigned-int.patch added to -mm tree 2018-11-06 15:44 ` Matthew Wilcox @ 2018-11-06 17:01 ` Alexey Dobriyan 0 siblings, 0 replies; 3+ messages in thread From: Alexey Dobriyan @ 2018-11-06 17:01 UTC (permalink / raw) To: Matthew Wilcox; +Cc: linux-kernel, tglx, linux-arch 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@linux-foundation.org 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. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-06 17:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20181105233301.KlgdF%akpm@linux-foundation.org>
2018-11-06 15:14 ` + fls-change-parameter-to-unsigned-int.patch added to -mm tree Alexey Dobriyan
2018-11-06 15:44 ` Matthew Wilcox
2018-11-06 17:01 ` Alexey Dobriyan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox