Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2081267imm; Sat, 29 Sep 2018 10:00:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV61lHK1SY/RdiEFTrK/+/OJnXkwTbnLT5sr+vTpkJAwTNU2Y+3L8vsC8xqi9Dc++aYmY3OWr X-Received: by 2002:a17:902:64c1:: with SMTP id y1-v6mr3804376pli.301.1538240447738; Sat, 29 Sep 2018 10:00:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538240447; cv=none; d=google.com; s=arc-20160816; b=nJ9Chzj8aMQ4XleMRjjGDf48ll+WYVD9ctXiSMVd/1kSnC7crSCtJ+zsPkioNAeEeN bE7EYmI4k9kzoLQft9ZNoAhDDj1FX2S32BBKrGhxZPKERYIYvU8YiZaNFW7rC/zZniGN 7xa2HCpSD/IbL6VNDSBGwpM1+kXPm/ONEL++KiaEBw7JneYhqLjGyr/L+6TSIEhWBSNt fJM8SpyRkA5lNmEC4uPOyyAy+Bnp6yWrY0UuvbKaVl4AB27w7RgY4y2NKOceauc5asjV f8NgMlJ/AKFqJQo1u9YkYem2kQg8coWm5PcPBS+dbmXHESm/jrE+NFNTzdun1nRb2+5B jw/Q== 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=ODjr3zbHv3AYPYrSn2OOKQgmhgdO8oFZ9a+FV2crUoM=; b=D27XtDeDu72aiY7SaEnT7zXvMJuR9FQBqn8WL9Va8F3lBNTXG4Hj+2PJomFu8BTNKc VbK6O21khNz7et8rqesF57QDB1n7f4ydPnNs9R/+nTBAXAybvzYONP2S0xXaNG8BUgWv /rN0+6X6dGIb4ZXokwFlYsewHcJlQ0gRxwDsT0qAkpQaJxQTQ1+T8AnkOntvs3hfPB8/ vesrvopx4o4z3UbkZHzVZjZ41DEbFlvlfsVI9tRpT87KKJzzhb5iabqEd4QuEktMIUrM dLL7sANezG0JyCeK0eQ9pG56MPv+fRiMG8oPX0dGxMnq6ceBN0EpflvBbC89AP/POfmf adBQ== 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 t90-v6si7835759pfi.221.2018.09.29.10.00.30; Sat, 29 Sep 2018 10:00:47 -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 S1728470AbeI2X3f (ORCPT + 99 others); Sat, 29 Sep 2018 19:29:35 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:38903 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728394AbeI2X3f (ORCPT ); Sat, 29 Sep 2018 19:29:35 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.08073233|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e01l07408;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=20;RT=20;SR=0;TI=SMTPD_---.CxVflgQ_1538240412; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.CxVflgQ_1538240412) by smtp.aliyun-inc.com(10.147.40.7); Sun, 30 Sep 2018 01:00:12 +0800 Date: Sun, 30 Sep 2018 01:00:11 +0800 From: Guo Ren To: Christoph Hellwig Cc: akpm@linux-foundation.org, arnd@arndb.de, daniel.lezcano@linaro.org, davem@davemloft.net, gregkh@linuxfoundation.org, jason@lakedaemon.net, marc.zyngier@arm.com, mark.rutland@arm.com, mchehab+samsung@kernel.org, peterz@infradead.org, robh@kernel.org, robh+dt@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, devicetree@vger.kernel.org, green.hu@gmail.com, Chen Linfei , Mao Han Subject: Re: [PATCH V6 13/33] csky: Library functions Message-ID: <20180929170011.GA27796@guoren-Inspiron-7460> References: <2418a9d77fb92ff7606c08e209d8994e4f21e7ff.1538058840.git.ren_guo@c-sky.com> <20180928162030.GE19827@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180928162030.GE19827@infradead.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 28, 2018 at 09:20:30AM -0700, Christoph Hellwig wrote: > > +unsigned long long notrace __bswapdi2(unsigned long long u) > > +{ > > + return (((u) & 0xff00000000000000ull) >> 56) | > > + (((u) & 0x00ff000000000000ull) >> 40) | > > + (((u) & 0x0000ff0000000000ull) >> 24) | > > + (((u) & 0x000000ff00000000ull) >> 8) | > > + (((u) & 0x00000000ff000000ull) << 8) | > > + (((u) & 0x0000000000ff0000ull) << 24) | > > + (((u) & 0x000000000000ff00ull) << 40) | > > + (((u) & 0x00000000000000ffull) << 56); > > +} > > How is this any better than using the generic byteswap helpers? OK. #include unsigned long long notrace __bswapdi2(unsigned long long u) { return ___constant_swab64(u); > > > +unsigned int notrace __bswapsi2(unsigned int u) > > +{ > > + return (((u) & 0xff000000) >> 24) | > > + (((u) & 0x00ff0000) >> 8) | > > + (((u) & 0x0000ff00) << 8) | > > + (((u) & 0x000000ff) << 24); > > +} > > Same here. OK. #include unsigned int notrace __bswapsi2(unsigned int u) { return ___constant_swab32(u); } Thx Guo Ren