Skip to main content
9 events
when toggle format what by license comment
Jun 17, 2020 at 9:04 history edited CommunityBot
Commonmark migration
May 16, 2016 at 18:12 history edited DJMcMayhem CC BY-SA 3.0
added 47 characters in body
May 16, 2016 at 14:48 comment added nwellnhof @Neil But the undefined behavior can be worked around without making the code larger. Here's an even shorter version using K&R function declarations: f(a,n,i)int*a;{for(i=1;++i<5;)*a++=n+i-n%i;}
May 16, 2016 at 14:12 comment added Neil @nwellnhof By my understanding of PPCG rules I think it's acceptable if you can find an implementation on which it works.
May 16, 2016 at 14:11 comment added Neil @nwellnhof Bah, I thought of that when I unrolled his loop but it didn't occur to me that he could use it anyway.
May 16, 2016 at 12:57 comment added nwellnhof Also s/a[i-2]/*a++/ to save two bytes.
May 16, 2016 at 12:55 comment added nwellnhof Doesn't n + i - n % i++ result in undefined behavior?
May 16, 2016 at 8:49 comment added Neil I looked at @xnor's bit-twiddling but you need to unroll the loop for that which ends up costing you a byte overall.
May 16, 2016 at 7:41 history answered DJMcMayhem CC BY-SA 3.0