C kerdes, NULL ptr
Moczik Gabor
pm at progzmaster.hu
Tue Jul 10 21:49:16 CEST 2007
Info wrote:
> Így nem lenne jobb ? (és gyorsabb)
>
> uint config_checksum(uchar* buf, uchar length, uint* checksum)
> {
> uint tmp_checksum=0;
> do{tmp_checksum+=(*buf++)}while(--length);
> if (checksum){*checksum=tmp_checksum}
> return tmp_checksum;
> }
Gyorsabb, bar azert nem kene egy sorba irni az egeszet...
Tovabba egy lepes lenne a fault-tolerant tervezes fele, ha length=0 eseten
nem csinalna hulyeseget, ehhez mindossze annyi kene csak, hogy
while(length--) {
tmp_checksum+= *buf++;
}
--
((( Móczik Gábor )))--((( pm -> @ -> progzmaster -> . -> hu )))
((( Skype: moczik )))
More information about the Elektro
mailing list