Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

In wiki, "big-endian" refers to the storage order of multiple bytes.

And a byte consists of 8 bits, it's also important to note the order of these bits.

I did dd if=/dev/sda count=1 | xxd -b, and found out that bytes are stored in the opposite increasing direction of address:

01100011 (lower address is on the left, while this byte is ascii character'c') It seems to be a bit-level "big-endian".

how to explain this odd phenomenon?

share|improve this question
    
why is that a phenomenon? it'd either be that or that backwards. And given that c is ascii 99 and numbers are (I suppose) read big endian, so it's easier like that. Why would big endian be more of a phenomenon than little endian? I guess it's confusing if bytes are in opposite order, though it's possible. . but you didn't show a paste that shows that. –  barlop Aug 30 '13 at 17:12

2 Answers 2

up vote 3 down vote accepted

xxd turns every byte it reads into a {hexadecimal,binary,octal} number and prints that, not a representation of how said byte was represented in memory or elsewhere. All the number-writing schemes I'm familiar with are big-endian, so that's what you get.

share|improve this answer

Bits are only presented in an order for display. They aren't stored in any particular order inside the computer. The exception would be cases where bits are individually addressable inside the processor. In all of those cases, 0 refers to the least-significant bit.

How xxd displays bits has nothing to do with how they are stored.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.