Does endianness apply to bit order too?

a 夏天 提交于 2020-07-15 01:30:05

问题


I haven't found a specific question here on SO, if this is a duplicate please point it out to me and I'll delete this.

So really, does endianness have anything to do with bit order?

This seems to imply the answer is NO, while other sources (I fail to find one right now, but surely I've read some time ago some articles) imply that endianness is the order of bytes and bits.

To be more specific: in a Big Endian architecture, where MSB is first, inside any byte, is also MSb first? Conversly, on Little Endian systems, where LSB is first, is LSb also first?

LAST EDIT: I found this which says "Bit order usually follows the same endianness as the byte order for a given computer system"


回答1:


The other responses are not completely accurate. Yes, memory is byte addressable, so usually endianness stops there. But addressability isn't the only way to create well defined endianness.

In C, you can define bit fields. Bit fields have particular layouts; for example, the first bit field, if one bit, could be stored in either the msb or the lsb, and wrapping bit fields across byte boundaries in a big endian way is strikingly different than doing so in a little endian way. So if you define bit fields, you may have bit endianness.

But how these are arranged would have more to do with the compiler than the architecture, at least as a rule.




回答2:


Endianness applied to only byte order. Not for bit order. The bit order remains same.

Why?

Memory is byte-addresseable. This is just a fancy way of saying that each address stores one byte. So You can change the order of bytes, not bits in memory.

Endianness only makes sense when you want to break a large value (such as a word) into several small ones. You must decide on an order to place it in memory.

Endianness only makes sense when you are breaking up a multi-byte quantity, and attempting to store the bytes at consecutive memory locations. But if you take in a register, it doesn't make sense. A register is simply a 32 bit quantity(depends on your processor/controller) and endianness does not apply to it.

Bit order usually follows the same endianness as the byte order for a given computer system - It is True

For more info Endianness




回答3:


No, simply because you cannot address bits individually.




回答4:


In modern computing endianness only applies to ordering of bytes, not bits.




回答5:


Little-endian CPUs usually employ "LSB 0" bit numbering, however both bit numbering conventions can be seen in big-endian machines. Some architectures like SPARC and Motorola 68000 use "LSB 0" bit numbering, while S/390, PowerPC and PA-RISC use "MSB 0".[2]

please see

http://en.wikipedia.org/wiki/Bit_numbering

http://en.wikipedia.org/wiki/Most_significant_bit




回答6:


Endianness works on the basis of bytes not bits. Bits are not addressable.




回答7:


Looking back at this question I asked some years ago, today I can add a partial response with an example where bit endianness exists and is important: in communication protocols. Any protocol specification needs to define which bit is sent first when an octet is pushed in a bit stream.



来源:https://stackoverflow.com/questions/25402080/does-endianness-apply-to-bit-order-too

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!