Here's a preview from my zine, How Integers and Floats Work! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!
read the transcript!
little endian / big endian
we write dates in two main orders
- 2023-03-17 (“big endian”)
- 17-03-2023 (“little endian”)
- 03-17-2023 (“american”)
“big endian” means that the big unit (the year) is at the start (“big end first”)
similarly: computers order bytes in 2 ways
Here are 2 ways your computer might represent the integer 271:
1. big endian: 00000001 00001111
2. little endian: 00001111 00000001
How this corresponds to 271:
00000001 00001111
is 271 in binary
When you send integers on a computer network, they have to be big endian. Here’s how that works:
Computer A has the 16-bit integer “271” in its memory: 00001111 00000001
Computer A flips the bytes and sends it as big endian: 00000001 00001111
Computer B receives the big endian integer
Computer B flips the bytes and stores it in memory as little endian: 00001111 00000001
a little history
Before 1980, computers ordered their bytes in different ways.
In 1980, the Internet started being standardized, causing a huge fight over which byte order to use on the Internet.
The terms “big/little endian” come from that fight: they were coined in an article called “On Holy Wars and a Plea For Peace” which compares the byte order fight to the Big/Little Endians in Gulliver’s Travels.
Big endian won that fight, so most Internet protocols (IPv4, TCP, UDP, etc.) are big endian.
But almost all modern computers are little endian. Some machines, like the Xbox 360, are big endian though.
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!