by userbinator · 8y ago · 0 comments
I've always found LE vs BE to be somewhat like 0- vs 1-based array indices; one is more "conventional" to a human, but the other doesn't require a lot of contortions when expressed algebraically or algorithmically.
(With 0-based indices, element i is at address base + i * size; with 1-based indices, it's base + (i-1) * size, and it only gets worse from there as you add dimensions and other calculations.)
0 array length <--- base pointer
1 element 1 <--- array[1] == *(base + 1)
2 element 2 <--- array[2] == *(base + 2)