Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp283576ybz; Tue, 21 Apr 2020 08:59:22 -0700 (PDT) X-Google-Smtp-Source: APiQypK+6Pl9xmXhSMV5ocmGYBl3a2TfKPYK7SF5MVWgWoOGln0b8CnKYkuNb+w3+wYmEBOOrePb X-Received: by 2002:a17:907:9484:: with SMTP id dm4mr22291525ejc.240.1587484762678; Tue, 21 Apr 2020 08:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587484762; cv=none; d=google.com; s=arc-20160816; b=cFXEJ5YMJbHDpDn3NNEutCgWt8vQRsUYwZALtRUIZ0y/DoPEmypHE8PHrOv066U1hE 5EtxcyhBHJDizMyZ5AjHe1jXr3QT6CvW/SqhpfOuga7lBc8QnWRTM7UqVuIPNSoKnukW Em1joGjl08c03ztqzs0AMvgjpGDWS1Atg71j0N3KxVK94WupP51QFSJtaSxmQvrdUWDy TeQeAIld7nMsPg+tsqExa6Rms50tKYrQ5AAVlORhpgG3Mn2RHQkgOQ/jz34YNB4sRj2C SrLzeuXXRvpnuJ1Iy6YJG5tBiw8Kg0kdbiL1T/XSHx9+zmFnKEPr8ux5o/HUNO0DcPk6 9O3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=38NAkiFk87nNNYJU3qcpflMe9LXKlU0z0dsk576Bzhg=; b=Kyj4zKLuYEX5Io/GrmdVktayZBJnGZuL0FyrevCh7NDNKjNA4ocsNoHhRjrJcWw2UX 5LnC7S94uklSQLhNkT12G1JuhW7/l/W0HezJ137A8sLtQsEDA+14yg0Jy2O25rcsgM5b kYlE0xOL9BFISoT0ATTE53MY3NOF2Wj7RIO/Y6NTPxru8UsjI24HMh4nSbqXs95+PGMN DrewfRXkeo+A5TOMMXNIysN2/Tq8PvfAL9rn8kEbCcSxGmZwrke/rtWcJaAcKE3QDWyc 20izEzez9NIWwssww9LAlTtN+VAzcW76JTwcdUxCdKkk7G8T1TQXfD92FEWrPHI+K7gr xxuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s27si1748174eja.411.2020.04.21.08.58.59; Tue, 21 Apr 2020 08:59:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727775AbgDUP4A (ORCPT + 99 others); Tue, 21 Apr 2020 11:56:00 -0400 Received: from gate.crashing.org ([63.228.1.57]:44895 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725963AbgDUP4A (ORCPT ); Tue, 21 Apr 2020 11:56:00 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 03LFtMkQ010973; Tue, 21 Apr 2020 10:55:22 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 03LFtG0c010964; Tue, 21 Apr 2020 10:55:16 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Tue, 21 Apr 2020 10:55:16 -0500 From: Segher Boessenkool To: Joel Stanley Cc: Christophe Leroy , linux-fbdev@vger.kernel.org, kvm@vger.kernel.org, Linux Kernel Mailing List , dri-devel@lists.freedesktop.org, Paul Mackerras , alsa-devel@alsa-project.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 2/5] powerpc: Replace _ALIGN_DOWN() by ALIGN_DOWN() Message-ID: <20200421155516.GT26902@gate.crashing.org> References: <3911a86d6b5bfa7ad88cd7c82416fbe6bb47e793.1587407777.git.christophe.leroy@c-s.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi! On Tue, Apr 21, 2020 at 01:04:05AM +0000, Joel Stanley wrote: > On Mon, 20 Apr 2020 at 18:38, Christophe Leroy wrote: > > _ALIGN_DOWN() is specific to powerpc > > ALIGN_DOWN() is generic and does the same > > > > Replace _ALIGN_DOWN() by ALIGN_DOWN() > > This one is a bit less obvious. It becomes (leaving the typeof's alone > for clarity): > > -((addr)&(~((typeof(addr))(size)-1))) > +((((addr) - ((size) - 1)) + ((typeof(addr))(size) - 1)) & > ~((typeof(addr))(size)-1)) > > Which I assume the compiler will sort out? [ This is line-wrapped, something in your mailer? Took me a bit to figure out the - and + are diff -u things :-) ] In the common case where size is a constant integer power of two, the compiler will have no problem with this. But why do so complicated? Why are the casts there, btw? Segher