Timeline for Area of an ASCII polygon
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 28, 2015 at 12:01 | history | edited | Jonathan Aldrich | CC BY-SA 3.0 |
more optimization
|
Apr 28, 2015 at 11:48 | history | edited | Jonathan Aldrich | CC BY-SA 3.0 |
optimization
|
Apr 28, 2015 at 11:38 | comment | added | DaedalusAlpha |
Also as mentioned above, apparently global variables are automatically set to 0, so if int i,t,v; was to be put in front of main instead of inside we could get rid of i=t=s=0 altogether saving another 7 bytes.
|
|
Apr 28, 2015 at 11:28 | comment | added | DaedalusAlpha |
Using the idea of the for loop above I think you can do something like this: ...int i,t,s;for(i=t=s=0;c=v[1][i++];t+=s+(c>46^!(c%19)^s))s^=c>13^c%9>4;... which should save 4 bytes; one {, one } and two ;
|
|
Apr 28, 2015 at 3:58 | comment | added | Ypnypn |
Welcome and good job! You may be able to skip the i=t=s=0; I think C initializes all int s to 0 anyway. Also, see if you can turn the while loop into a for loop; that often saves a few bytes.
|
|
Apr 28, 2015 at 1:26 | history | edited | Jonathan Aldrich | CC BY-SA 3.0 |
added explanation, corrected byte count
|
Apr 28, 2015 at 1:14 | review | First posts | |||
Apr 28, 2015 at 2:00 | |||||
Apr 28, 2015 at 1:14 | history | answered | Jonathan Aldrich | CC BY-SA 3.0 |