All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	Roger Willcocks <roger@filmlight.ltd.uk>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Ben Skeggs <bskeggs@redhat.com>, David Airlie <airlied@linux.ie>,
	Daniel Vetter <daniel@ffwll.ch>,
	Leon Romanovsky <leon@kernel.org>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	linux-xfs@vger.kernel.org,
	dri-devel <dri-devel@lists.freedesktop.org>,
	nouveau@lists.freedesktop.org,
	linux-rdma <linux-rdma@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [RFC][PATCH] kernel.h: Add generic roundup_64() macro
Date: Fri, 24 May 2019 19:30:45 +0300	[thread overview]
Message-ID: <bd4a85fc-dc56-aae0-4986-003ad4a11ef4@suse.com> (raw)
In-Reply-To: <20190524112656.5ef67c6c@gandalf.local.home>



On 24.05.19 г. 18:26 ч., Steven Rostedt wrote:
> On Fri, 24 May 2019 16:11:14 +0100
> Roger Willcocks <roger@filmlight.ltd.uk> wrote:
> 
>> On 23/05/2019 16:27, Steven Rostedt wrote:
>>>
>>> I haven't yet tested this, but what about something like the following:
>>>
>>> ...perhaps forget about the constant check, and just force
>>> the power of two check:
>>>
>>> 							\
>>> 	if (!(__y & (__y >> 1))) {			\
>>> 		__x = round_up(x, y);			\
>>> 	} else {					\  
>>
>> You probably want
>>
>>             if (!(__y & (__y - 1))
>>
>> --
> 
> Yes I do. I corrected it in my next email.
> 
>  http://lkml.kernel.org/r/20190523133648.591f9e78@gandalf.local.home

Or perhaps just using is_power_of_2 from include/linux/log2.h ?
> 
>> #define roundup(x, y) (					\
>> {							\
>> 	typeof(y) __y = y;				\
>> 	typeof(x) __x;					\
>> 							\
>> 	if (__y & (__y - 1))				\
>> 		__x = round_up(x, __y);			\
>> 	else						\
>> 		__x = (((x) + (__y - 1)) / __y) * __y;	\
>> 	__x;						\
>> })
> 
> 
> -- Steve
> 

  reply	other threads:[~2019-05-24 16:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23 14:00 [RFC][PATCH] kernel.h: Add generic roundup_64() macro Steven Rostedt
2019-05-23 14:00 ` Steven Rostedt
2019-05-23 15:10 ` Linus Torvalds
2019-05-23 15:27   ` Steven Rostedt
     [not found]     ` <20190523112740.7167aba4-f9ZlEuEWxVcJvu8Pb33WZ0EMvNT87kid@public.gmane.org>
2019-05-23 16:51       ` Linus Torvalds
2019-05-23 16:51         ` Linus Torvalds
2019-05-23 17:36         ` Steven Rostedt
2019-05-23 21:19           ` Linus Torvalds
2019-05-24 15:11     ` Roger Willcocks
2019-05-24 15:26       ` Steven Rostedt
2019-05-24 16:30         ` Nikolay Borisov [this message]
     [not found]           ` <bd4a85fc-dc56-aae0-4986-003ad4a11ef4-IBi9RG/b67k@public.gmane.org>
2019-05-24 16:36             ` Steven Rostedt
2019-05-24 16:36               ` Steven Rostedt

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=bd4a85fc-dc56-aae0-4986-003ad4a11ef4@suse.com \
    --to=nborisov@suse.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=bskeggs@redhat.com \
    --cc=daniel@ffwll.ch \
    --cc=darrick.wong@oracle.com \
    --cc=dledford@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=roger@filmlight.ltd.uk \
    --cc=rostedt@goodmis.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.