mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: linux-kernel@vger.kernel.org, fare@tunes.org
Cc: Grant Grundler <grundler@parisc-linux.org>
Subject: Bug in cpu_to_le32
Date: Mon, 1 Nov 2004 02:23:11 +0000	[thread overview]
Message-ID: <20041101022311.GG8958@parcelfarce.linux.theplanet.co.uk> (raw)


Grant Grundler spotted we weren't using the optimised byteswap routines
on PA-RISC.  Here's why:

include/linux/byteorder/generic.h:90:#define le32_to_cpu __le32_to_cpu
include/linux/byteorder/big_endian.h:33:#define __le32_to_cpu(x) ___swab32((__force __u32)(__le32)(x))
and byteorder/swab.h:
#define ___swab32(x) \
({ \
        __u32 __x = (x); \
        ((__u32)( \
                (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | \
                (((__u32)(__x) & (__u32)0x0000ff00UL) <<  8) | \
                (((__u32)(__x) & (__u32)0x00ff0000UL) >>  8) | \
                (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \
})

So le32_to_cpu() doesn't use optimised assembler on any platform.  And for
all you using ext3 on i386 ...

include/linux/byteorder/generic.h:95:#define cpu_to_be32 __cpu_to_be32
include/linux/byteorder/little_endian.h:38:#define __cpu_to_be32(x) ((__force __be32)___swab32((x)))

So it's not being used there either.  What is ___swabN() for anyway?  It seems
to be a duplicate of ___constant_swabN().

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

                 reply	other threads:[~2004-11-01  2:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20041101022311.GG8958@parcelfarce.linux.theplanet.co.uk \
    --to=matthew@wil.cx \
    --cc=fare@tunes.org \
    --cc=grundler@parisc-linux.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome