April 22nd, 2015, 2:39 pm
Looked to me like it was trying to get month-end dates, but as I've never used C, I had to find out what the operators do. I'm still not clear on bits of it.m ^ 2 ? ... : ...seems to be the equivalent of 'if m=2, do the stuff after the colon, else do the stuff before the colon.'So if m (month) isn't February, return 31 - --m % 7 % 2'--m % 7 % 2' returns 1 if the month doesn't have 31 days (every second month has <31 days until you get to August, then you need every second month from July. This is the % 7 % 2 bit).So we return 31 where there are 31 days in the month, 30 otherwise.If m is February, return '29 - (y & 3 || y & 15 && !(y % 25))'I don't understand the operators here. I get that 'y & 3' returns 0 if the year is a multple of 4 (ie a leap year). I don't get the rest of it.