From: c.a.subramaniam@gmail.com (Subramaniam Appadodharana)
To: kernelnewbies@lists.kernelnewbies.org
Subject: How to figure out the byteorder only with one byte number?
Date: Mon, 20 Feb 2012 07:53:10 -0600 [thread overview]
Message-ID: <CAJydemmBeUb86MzfWYY-e3mCC6jJxBR08=Hae7knORN--iFX4w@mail.gmail.com> (raw)
In-Reply-To: <CAOe6JY1xb8puGZn9Oq3=xQG2vSJQCYjKOkygRAO-aYZ_0AdZ+A@mail.gmail.com>
Hi Tao,
On Mon, Feb 20, 2012 at 5:25 AM, Tao Jiang <jiangtao.jit@gmail.com> wrote:
> Hi:
>
> Thank you all.
>
> Take a byte number 0b00000001 for example
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ^ ? ? ? ? ? ? ^
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? high bit ? ? low bit
>
> I used to think in a LE machine it will be stored as 0b10000000 low bit first
>
> ? ? ? ? ? ?^ ? ? ? ? ? ? ^
>
> ? ? ? ?low bit ? ? high bit
>
> and in a BE machine will be 0b00000001 high bit first
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^ ? ? ? ? ? ? ^
> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? high bit ? ?low bit
>
> not only the byteorder is different, but inside a byte is also different.
>
> But actually they are the same, right?
yes they are same. In fact it is termed as 'byte' order not 'bit'
order. Hope this helps.
> Thank you.
>
>
>
> 2012/2/20 Graeme Russ <graeme.russ@gmail.com>:
>> On 02/20/2012 01:24 AM, Bernd Petrovitsch wrote:
>>> On Sun, 2012-02-19 at 20:08 +0800, Tao Jiang wrote:
>>> [...]
>>>> Is there some difference of the storge between BE and LE machine inside a byte?
>>>
>>> No. At least TTBOMK there exists no such hardware.
>>
>> Using SHL/SHR would tell you - SHL normally results in a multiply by 2, SHR
>> a divide by 2. If the byte was little endian, the results would be visa-versa
>>
>> But I agree, I doubt there is any such hardware
>>
>> Regards,
>>
>> Graeme
>>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next prev parent reply other threads:[~2012-02-20 13:53 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
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 [this message]
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='CAJydemmBeUb86MzfWYY-e3mCC6jJxBR08=Hae7knORN--iFX4w@mail.gmail.com' \
--to=c.a.subramaniam@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).