[BusyBox] Optimizing ping size

Roberto Alcantara roberto at fortalnet.com.br
Tue Jun 14 17:52:07 UTC 2005


Guys, that's just small changes to gain some bit in ping applet.

$size ping.o original/ping.o
    text    data     bss     dec     hex filename
    2382       8     192    2582     a16 ping.o
    2394       8     192    2594     a22 original/ping.o


regards,
Roberto Alcantara
-------------- next part --------------
78a79
> 	unsigned short ans = 0;
84,86c85,89
< 	
<   if (nleft == 1) 
<       sum += *(unsigned char *) w;
---
> 
> 	if (nleft == 1) {
> 		*(unsigned char *) (&ans) = *(unsigned char *) w;
> 		sum += ans;
> 	}
90c93,94
< 	return (~sum);
---
> 	ans = ~sum;
> 	return (ans);
143c147
< 		} 
---
> 		}
186a191,192
> 	int status;
> 
201c207
< 	  	       (tsum / (nreceived + nrepeats)) % 10, tmax / 10, tmax % 10);
---
> 			   (tsum / (nreceived + nrepeats)) % 10, tmax / 10, tmax % 10);
203c209
< 		exit(EXIT_SUCCESS);
---
> 		status = EXIT_SUCCESS;
205c211,212
< 		exit(EXIT_FAILURE);
---
> 		status = EXIT_FAILURE;
> 	exit(status);
227a235
> 
323c331
< 		putchar('\n');
---
> 		printf("\n");


More information about the busybox mailing list