News for hackers. Stuff that matters.
Re:Ask HN: Is big-endian dead? by userbinator on Friday January 19, 2018 @08:32PM (#16191505)
Yes, LE is actually the more logical and elegant one, since bit n has weight 2^n, and byte n has a weight 256^n. The BE equivalents introduce an extra length- term into the equation (length-n).

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.)

Re:Ask HN: Is big-endian dead? by TheOtherDave on Friday January 19, 2018 @08:51PM (#16191574)
Or you could just decrement base.
Re:Ask HN: Is big-endian dead? by PeCaN on Friday January 19, 2018 @10:45PM (#16191936)
This also conveniently allows you to store the length at the "real" base.

    0 array length <--- base pointer
    1 element 1    <--- array[1] == *(base + 1)
    2 element 2    <--- array[2] == *(base + 2)
Re:Ask HN: Is big-endian dead? by benaadams on Saturday January 20, 2018 @06:10AM (#16192970)
0-based offsets