Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp598155ybi; Fri, 24 May 2019 08:28:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyGHk5AXaTA1wfJqrKauxew+2gu29o/PX7Yd8fudAGCInBJDcVgLz3T/OMx1qWG45WTgBBQ X-Received: by 2002:a17:902:778d:: with SMTP id o13mr47807902pll.275.1558711710490; Fri, 24 May 2019 08:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558711710; cv=none; d=google.com; s=arc-20160816; b=k2FfTwLJtvx17R271QAvwNPeTfEDtvqan8/vsiRIU1Ow+BTGxiQNC0yf3a4gGyYLtk 6adtbZx6Ml2p4BzWUwQbrvyBOkvzSjufO2YdABB7yMP29kt9Nxa95g8+l4pAbDe+cNUw OIaB2la78UZI3LtEn9FSuVrgaA8DGc6LS8zzEYjGOwxV0uwzkbTKt8pNjQuCWm6khKxy /Z2c/S3E/8evDCeNPerxVvRUjohY6KDRspiiKa8jq+60vBbRWTl58ibgqHqz2tgAjWoI zRzbLoiSrlXiRf/ex9kNAuZLa2BkNbq/LSCKjJH6Z3jDg5zFF2fjGg9ZMUsjNO/ZePIG u4fw== 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:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=+0RvXlQZ3IRdVYqZ16sFZGq3djJreJ3D5U/ilQvMPZI=; b=JNfuRxs5MMX4ZVykZgVMAkr0MBUrasSFK2/DhOuYS4i+0jS43GhmYQVgxn0K7wSIe/ i0qqYMkb+eYm0hAJG8p8Og0T63U86k3omJcW3Fiap+HH2YpDNZ8ZeuS7z/IyhSElgvM1 NB7PsG3Okr6gfnAQJBKU+l7h6fEtXrcbpqXaEtPA5jjYtokiSC7mHaD4XVGQxwS/7OC8 8WpeTsf6iC05eMP7Mlqx/LP5Q0qBWoyui6E6y4FSEKqbYVBd/gkeU9geXhHuW2EkvHhm qjLqY69a9Yqd+dztSEjNtDKS2Bb6Ea97R60aFTCJw1op3k8NNUnEQlkw/t4dkxyLCgkN glng== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si5030736pgh.192.2019.05.24.08.28.12; Fri, 24 May 2019 08:28:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389550AbfEXP07 convert rfc822-to-8bit (ORCPT + 99 others); Fri, 24 May 2019 11:26:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:41592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389079AbfEXP07 (ORCPT ); Fri, 24 May 2019 11:26:59 -0400 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 899612133D; Fri, 24 May 2019 15:26:57 +0000 (UTC) Date: Fri, 24 May 2019 11:26:56 -0400 From: Steven Rostedt To: Roger Willcocks Cc: Linus Torvalds , 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 Message-ID: <20190524112656.5ef67c6c@gandalf.local.home> In-Reply-To: References: <20190523100013.52a8d2a6@gandalf.local.home> <20190523112740.7167aba4@gandalf.local.home> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 24 May 2019 16:11:14 +0100 Roger Willcocks 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 > #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