From: Adrian Reber <adrian@lisas.de>
To: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: Endian/__BYTE_ORDER question
Date: Thu, 11 Feb 2010 17:33:29 +0100 [thread overview]
Message-ID: <20100211163328.GC16348@lisas.de> (raw)
In-Reply-To: <OF43B135B0.EF8D9CB9-ONC12576C7.00588245-C12576C7.00598135@transmode.se>
On Thu, Feb 11, 2010 at 05:17:37PM +0100, Joakim Tjernlund wrote:
> I am getting confused about on how to test for Endian in the kernel code. In user
> space one uses #if __BYTE_ORDER == __LITTLE_ENDIAN or #if __BYTE_ORDER == __BIG_ENDIAN
>
> I can see lots of kernel headers using this test too, but it doesn't seem
> to be an arch specific file #defining __BYTE_ORDER. Instead I find files like:
> arch/alpha/math-emu/sfp-util.h
> arch/powerpc/include/asm/sfp-machine.h
> arch/s390/include/asm/sfp-util.h
> arch/sh/math-emu/sfp-util.h
>
> How is this supposed to work?
I have no idea how it is actually done in the kernel code... but gcc
defines it:
gcc -dM -E -x c - <<<'' | grep ENDIAN
#define __BIG_ENDIAN__ 1
#define _BIG_ENDIAN 1
Adrian
next prev parent reply other threads:[~2010-02-11 16:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-11 16:17 Endian/__BYTE_ORDER question Joakim Tjernlund
2010-02-11 16:21 ` Joakim Tjernlund
2010-02-11 16:33 ` Adrian Reber [this message]
2010-02-11 16:55 ` Joakim Tjernlund
2010-02-11 21:39 ` Wolfgang Denk
2010-02-11 23:09 ` Joakim Tjernlund
2010-02-12 10:33 ` Geert Uytterhoeven
2010-02-12 10:48 ` Joakim Tjernlund
2010-02-11 16:35 ` Andreas Schwab
2010-02-11 16:52 ` Joakim Tjernlund
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=20100211163328.GC16348@lisas.de \
--to=adrian@lisas.de \
--cc=joakim.tjernlund@transmode.se \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).