So I've been trying to understand endianess for the past couple of days but I'm not sure if I'm overthinking this or not and I don't have anyone I can ask to confirm things.
Here is how I look at things.. Say you have a defined value which represents the amount of pebbles there are in my city.
Decimal: 1193046
Hex: 0x123456
Binary: 0001 0010 0011 0100 0101 0110
These all carry the same weight but they're represented in various different ways, they all have one thing in common and that's that the most significant number is located all the way to the left due to how positional notation works.
Which means that the most significant byte would be 0001 0010
and this has nothing to do with endianess afaik.
Now say we create an int variable and store the decimal representation in it, that means that the computer will allocate 4 bytes of space in memory.
Unassigned allocated memory
0 (0000 0000) - 1 (0000 0000) - 2 (0000 0000) - 3 (0000 0000)
What I'm about to explain next is based off of the fact that I think it's safe to assume that a CPU always reads left to right, no matter endianess, is that something that's safe to assume? Because endianess only dictates how the CPU decides to store the bytes from a given value, right?
This is a more visual representation of what I think is going on
ALLOCATE 4 Bytes
PLACE Bytes (LE/BE)
LE
0 (0000 0000) - 1 (0001 0010) - 2 (0011 0100) - 3 (0101 0110)
BE
0 (0000 0000) - 1 (0101 0110) - 2 (0011 0100) - 3 (0001 0010)
My theory is strongly based off of the fact that I think that the lowest memory address is always to the left, and that the CPU reads/writes bytes from left to right no matter it's architecture, however when it stores a value that's greater than 1 byte, it stores the most significant byte first or last based on it's endianess.
Am I super wrong here or do I kind of have a slight idea of what's going on?