Re: How to figure out the byteorder only with one byte number?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>:
> 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@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxx
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
> --
> Peter Senna Tschudin
> peter.senna@xxxxxxxxx
> gpg id: 48274C36

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux