Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp590253ybi; Fri, 24 May 2019 08:21:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9x9dZ3MWG632DGHNln/jHbRib52/9tggdWjEzIfiYelmzT1mC1zb6ah6ZAwhCKrjgTTrA X-Received: by 2002:a63:d354:: with SMTP id u20mr57352837pgi.129.1558711305085; Fri, 24 May 2019 08:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558711305; cv=none; d=google.com; s=arc-20160816; b=TBlDHjdyMHnX/SQOsyIkkM9qGI4DT0jCw3ZklDAGvWgMV2BzJt6/whd7CgGoel/a2T 1wx2dlkH3zl8t4HAfOYs3wURbisicin0omrr8LK1tDIRBOPOdVtAE1h8BbsLfJaP7gtG 1dyNxXw+qSZAbNSmKEIRKIe7wKT+lOffecrcaIAaBkICKXz9fd0J0xs8/uCMeEAoEGFx O70RbOEoCQjJN2gYenN4CdK007j+ojaWbn7yqzmki7T2dLlKcuQLtdq7ZiHYz0xsaTjA a6guRmwn0IalcRlRpgJnMPb4k0+XD5ilTIiKS4HRcGs2VXk9XTdEGicNa3SC846v/Npm XQng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:cc:dkim-signature:dkim-filter; bh=0Ug3SmMBjFHqgISSjAkOrPxbVWMmS3DdLx7SQNNyROg=; b=jQTdIIKRLFwfbwvCypIrWVnk3S9Vuacee95pFdIERnk5hmMZjnVEokYYC2Jp1Z3UYU WuoQwln6YAfk/paNOCudOCEX7k/B2EddeRY193LilUOAly2FE0Gx/lmIR2frWgcd8JaA STo/X6EGjFxnpCqQdyThHlQ+t+ngVfCX3Gm4NfxA8oljti9byvoSRrJO6VzYollE15Am COawT7fsBv+mg4XF9DPLXF75WxzRbTDgFoau9Pz1mG3HQ3hWyxPCHr3dqiR0HLY+1Tpl 4m3tnsNPruD3gOWXZYfY9e4hWlWVqpR/5EUHAi99ptpRVY4wKJ3XHqoKOk+heE63cdWb u8oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@filmlight.ltd.uk header.s=default header.b=wpXaBT07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=filmlight.ltd.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q15si4050499pjp.95.2019.05.24.08.21.28; Fri, 24 May 2019 08:21:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@filmlight.ltd.uk header.s=default header.b=wpXaBT07; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=filmlight.ltd.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389765AbfEXPUM (ORCPT + 99 others); Fri, 24 May 2019 11:20:12 -0400 Received: from c.mx.filmlight.ltd.uk ([54.76.112.217]:35009 "EHLO c.mx.filmlight.ltd.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389428AbfEXPUL (ORCPT ); Fri, 24 May 2019 11:20:11 -0400 X-Greylist: delayed 535 seconds by postgrey-1.27 at vger.kernel.org; Fri, 24 May 2019 11:20:10 EDT Received: from localhost (localhost [127.0.0.1]) by omni.filmlight.ltd.uk (Postfix) with ESMTP id E84FD40000D9; Fri, 24 May 2019 16:11:14 +0100 (BST) DKIM-Filter: OpenDKIM Filter v2.11.0 omni.filmlight.ltd.uk E84FD40000D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=filmlight.ltd.uk; s=default; t=1558710674; bh=0Ug3SmMBjFHqgISSjAkOrPxbVWMmS3DdLx7SQNNyROg=; h=Cc:Subject:To:References:From:Date:In-Reply-To:From; b=wpXaBT074VJO3lUY2B3AqfKB/W8kA/0eApqSZ41aOSGqNLFXeF+yci3TFm4WhVp4H kV37VGx9Na/NLT5TmdU7mOXvKRov8tvnBDw7t4Am86QVyAKBCTZ3DDWsVdZoEArlfE 1m3WIQhTP2Qa/l+lxluF+WXJkuQNf4b1SOeoeu50= Received: from montana.filmlight.ltd.uk (envoy [62.7.83.226]) (Authenticated sender: roger) by omni.filmlight.ltd.uk (Postfix) with ESMTPSA id AB169887FAA; Fri, 24 May 2019 16:11:14 +0100 (BST) Cc: roger@filmlight.ltd.uk, LKML , Ben Skeggs , David Airlie , Daniel Vetter , Leon Romanovsky , Doug Ledford , Jason Gunthorpe , "Darrick J. Wong" , linux-xfs@vger.kernel.org, dri-devel , nouveau@lists.freedesktop.org, linux-rdma , Andrew Morton Subject: Re: [RFC][PATCH] kernel.h: Add generic roundup_64() macro To: Steven Rostedt , Linus Torvalds References: <20190523100013.52a8d2a6@gandalf.local.home> <20190523112740.7167aba4@gandalf.local.home> From: Roger Willcocks Message-ID: Date: Fri, 24 May 2019 16:11:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190523112740.7167aba4@gandalf.local.home> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 =3D round_up(x, y); \ > } else { \ You probably want =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 if (!(__y &= (__y - 1)) -- Roger