←back to thread

420 points gnabgib | 1 comments | | HN request time: 0.252s | source
Show context
captaincrunch ◴[] No.44000123[source]
This is fast, READABLE, and accurate:

bool is_leap_year(uint32_t y) { // Works for Gregorian years in range [0, 65535] return ((!(y & 3)) && ((y % 25 != 0) || !(y & 15))); }

replies(3): >>44000304 #>>44000522 #>>44003153 #
1. windward ◴[] No.44003153[source]
>READABLE

Great. It will be useful for the exhaustive tests of the faster version.