Leap year check in three instructions

Bit twiddling / integer math dive.

(To prove my nerd cred, I have to point out that this solution doesn’t explain/consider the Julian/Gregorian switch, but admittedly that’s a hairy question that requires knowing historical geography.)

I wonder if there are similar magic constants for 16 bit arithmetic - 16 bits gives quite enough year numbers to be going on with.