From: jiangtao.jit@gmail.com (Tao Jiang)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How to figure out the byteorder only with one byte number?
Date: Sun, 19 Feb 2012 20:08:47 +0800 [thread overview]
Message-ID: <CAOe6JY0bZm5O4MncN0zZt0kkjrctv+X9VGC8gZLVC36WPLoY3A@mail.gmail.com> (raw)
In-Reply-To: <CA+MoWDqwvmNFtXW3aBgO2HwtnOup5TLxeBQVwJOZZs8zDyH=Yw@mail.gmail.com>
Peter:
Thank you very much!
I've read the url.
But it's not what i mean to ask for.
Those methods all use an int or a short number and converting.
What I really want to ask for is:
unsigned char byte = 0b00000100;
do some shifts like byte << 1
then find out the machine's byteorder
Is there some difference of the storge between BE and LE machine inside a byte?
Thank you.
2012/2/18 Peter Senna Tschudin <peter.senna@gmail.com>:
> I found:
>
> http://stackoverflow.com/questions/2100331/c-macro-definition-to-determine-big-endian-or-little-endian-machine
>
> On Sat, Feb 18, 2012 at 12:33 PM, Tao Jiang <jiangtao.jit@gmail.com> wrote:
>> Hi:
>>
>> As far as I know, we can use an integer 0x12345678 with four bytes
>> and bytes[4] array to figure out a machine's byteorder
>>
>> Is there a method use only one byte 0x01
>> and some shifts do the same work?
>>
>> Thank you.
>>
>> ---------------
>> jiangtao
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> --
> Peter Senna Tschudin
> peter.senna at gmail.com
> gpg id: 48274C36
next prev parent reply other threads:[~2012-02-19 12:08 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-18 14:33 How to figure out the byteorder only with one byte number? Tao Jiang
2012-02-18 15:59 ` Peter Senna Tschudin
2012-02-19 12:08 ` Tao Jiang [this message]
2012-02-19 14:24 ` Bernd Petrovitsch
2012-02-19 17:19 ` Graeme Russ
2012-02-20 11:25 ` Tao Jiang
2012-02-20 13:53 ` Subramaniam Appadodharana
2012-02-20 22:32 ` THAI NGUYEN
2012-02-21 1:22 ` Sri Ram Vemulpali
2012-02-21 12:30 ` Tao Jiang
2012-02-21 12:48 ` Bernd Petrovitsch
2012-02-22 11:27 ` Tao Jiang
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=CAOe6JY0bZm5O4MncN0zZt0kkjrctv+X9VGC8gZLVC36WPLoY3A@mail.gmail.com \
--to=jiangtao.jit@gmail.com \
--cc=kernelnewbies@lists.kernelnewbies.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).