|
From: | Michael Rice |
Subject: | Re: [avr-libc-dev] [avr-libc-commit] [2358] Reverted month_length() back to using the 'knuckles' algorithm. |
Date: | Wed, 24 Apr 2013 18:09:23 -0400 |
int is_leap_year(int year){ return (year%4==0)?( (year%100==0)? ( (year%400==0)? 1 : 0) : 1) : 0; }An elegant 1 liner, which compiles to ~44 bytes. But the brutishly ugly, multi line method I used in the library compiles to 38, and most people find it easier to understand.
In general, I have found that breaking up those one liners into multiple lines, will often result in smaller and faster code. Not always, but usually.
[Prev in Thread] | Current Thread | [Next in Thread] |