Confused with endianess: bits or bytes?

I extracted this from the tutorial:

The Little-Endian order is the one we will use in this document, and unless specifically stated, you should assume that the Little-Endian order is used in any file. An alternative is the Big-Endian order. So let's see an example. Take the next stream or 8 bits 10001110. If you still followed the document, you would quickly calculate the value of this 8-bit number as 1x2 ^ 7 + 0x2 ^ 6 + ... + 1x2 ^ 1 + 0x2 ^ 0 = 142 This is an example little-finite ordering. However, in orders of the Big Endian we need to read the number in the opposite direction 1x2 ^ 0 + 0x2 ^ 1 + ... + 1x2 ^ 6 + 0x2 ^ 7 = 113

Is it correct?

I used to think that endianess has to do with ordering to read bytes (not bits).

+4
source share
3 answers

Yes, in the context of memory / storage, endianness really refers to byte ordering (usually). What would it mean to say, for example, the smallest bit "at first glance"?

The specificity of the bits is relevant in some situations, for example, when sending data via a serial bus.

+5
source

You are right - this quote you have trash, IMHO.

+1
source

It would not make sense to reorder the bits, and it would be rather confusing to load. Processors do not read bits with characters, they simultaneously read bytes or byte combinations, so it is important that this ordering.

When they store a number consisting of several bytes, they can either store it from left to right, making the high byte the smallest in memory, or right to left, with the low byte of the low byte in memory.

+1
source

Source: https://habr.com/ru/post/1390944/


All Articles