Quenby 17 hours ago

Never thought a leap year check could be this interesting. Maybe low-level programmers had already discovered tricks like this long ago,they just never got written down? Feels like there’s still so much like this, hidden in old code, waiting to be rediscovered. If anyone has a collection of these kinds of techniques, I’d really love to dig into it.

2
arp242 16 hours ago

Lotus 1-2-3 famously considers 1900 a leap year (carried over in Excel for compatibility), presumably because it just does the "(y & 3) != 0" check (arguably a reasonable optimisation given the hardware of the time).

I'd be surprised if someone found this solution before, as it seems both relatively difficult to find and a small optimisation.

nickdothutton 17 hours ago

There are things I had to learn at home in the 80s on the z80 that I have mostly forgotten. Very occasionally I wheel something out to “show the kids” (those in their 20s) and it feels like performing a magic trick.