From: Timur Tabi <timur@freescale.com>
To: Jan Engelhardt <jengelh@computergmbh.de>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: __LITTLE_ENDIAN vs. __LITTLE_ENDIAN_BITFIELD
Date: Fri, 05 Oct 2007 14:47:44 -0500 [thread overview]
Message-ID: <470694E0.7030408@freescale.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0710052138070.13406@fbirervta.pbzchgretzou.qr>
Jan Engelhardt wrote:
> Bit representation is left to the CPU, so 1 << 1 will always be 2,
> regardless of whether the byte, when sent out to the network,
> is 01000000 or 00000010. Endianess becomes important as soon
> as the packet is on the network, of course.
Well yes, that's why I'm asking. I'm not concerned about data from just the
CPU's perspective.
I'm writing a driver that talks to hardware that has a shift register. The
register can be shifted either left or right, so all the bits obviously have
to be in order, but it can be either order.
What I want to do is to have the driver detect when byte-endianness doesn't
match bit-endianness when it writes the the word to a memory-mapped device. I
think I can do that like this:
#if (defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN_BITFIELD)) ||
(defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN_BITFIELD))
#error "This CPU architecture is not supported"
#endif
--
Timur Tabi
Linux Kernel Developer @ Freescale
next prev parent reply other threads:[~2007-10-05 19:47 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-05 18:27 __LITTLE_ENDIAN vs. __LITTLE_ENDIAN_BITFIELD Timur Tabi
2007-10-05 18:35 ` Jan Engelhardt
2007-10-05 19:35 ` Timur Tabi
2007-10-05 19:43 ` Jan Engelhardt
2007-10-05 19:47 ` Timur Tabi [this message]
2007-10-05 20:04 ` Andreas Schwab
2007-10-05 20:07 ` Timur Tabi
2007-10-05 20:34 ` linux-os (Dick Johnson)
2007-10-05 20:37 ` Timur Tabi
2007-10-05 23:27 ` Benjamin Herrenschmidt
2007-10-05 21:17 ` Andreas Schwab
2007-10-05 21:06 ` Anton Altaparmakov
2007-10-05 21:10 ` Timur Tabi
2007-10-05 21:29 ` Andreas Schwab
2007-10-05 21:32 ` Timur Tabi
2007-10-05 23:17 ` Andreas Schwab
2007-10-09 17:46 ` Lennart Sorensen
2007-10-09 17:56 ` Timur Tabi
2007-10-09 18:34 ` Lennart Sorensen
2007-10-09 18:50 ` Krzysztof Halasa
2007-10-09 18:57 ` Timur Tabi
2007-10-09 19:37 ` Krzysztof Halasa
2007-10-09 19:44 ` Timur Tabi
2007-10-09 22:11 ` Krzysztof Halasa
2007-10-09 19:11 ` Jeremy Fitzhardinge
2007-10-09 19:39 ` Krzysztof Halasa
2007-10-09 21:40 ` Jeremy Fitzhardinge
2007-10-09 22:34 ` Krzysztof Halasa
2007-10-10 12:05 ` linux-os (Dick Johnson)
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=470694E0.7030408@freescale.com \
--to=timur@freescale.com \
--cc=jengelh@computergmbh.de \
--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