Article View: es.comp.os.linux.programacion
Article #18438Re: Una ayuda please :), piruleta por medio.
From: Ignacio Arenaza
Date: Mon, 06 Sep 1999 00:00
Date: Mon, 06 Sep 1999 00:00
41 lines
1817 bytes
1817 bytes
>>>>> "CJR" == CJR <cj.ramos@teleline.es> writes:
Reformateando ligeramente, queda asi:
CJR> void send(int* to, int* from, int count)
CJR> {
CJR> int n = (count+7)/8;
CJR> switch(count%8) {
CJR> case 0:
CJR> do { *to++ = *from++;
CJR> case 7: *to++ = *from++;
CJR> case 6: *to++ = *from++;
CJR> case 5: *to++ = *from++;
CJR> case 4: *to++ = *from++;
CJR> case 3: *to++ = *from++;
CJR> case 2: *to++ = *from++;
CJR> case 1: *to++ = *from++;
CJR> } while (--n>0);
CJR> }
CJR> }
Si 'count' no es multiplo de 8, no hace absolutamente nada. Si es
multiplo de 8, entonces copia de la direccion 'from' a la direccion
'to' tantos enteros como indique 'count'. Es una forma muy rara de
hacerlo, pero cada uno programa como quiere. De hecho, quitando toda
la parafernalia para despistar, es lo mismo que:
void send(int* to, int* from, int count)
{
if (count%8)
while ((count--) > 0)
*to++ = *from++;
}
Bastante mas corto, no?
Saludos. I�aki.
--
PGP Key available at http://personales.jet.es/inaki.arenaza/pgpkey.html
Linux Registered User #44369
Technical Details
Message-ID:
<87so4tq8lm.fsf@eb2ebu.ampr.org>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<37D2B3AB.CC6C91AF@teleline.es>Show Full Headers
Complete Article Headers
X-Google-Language: PORTUGUESE,ASCII X-Google-Thread: f86c8,ec38c86f5338aad7 X-Google-Attributes: gidf86c8,public From: Ignacio Arenaza <inaki.arenaza@jet.es> Subject: Re: Una ayuda please :), piruleta por medio. Date: 1999/09/06 Message-ID: <87so4tq8lm.fsf@eb2ebu.ampr.org> X-Deja-AN: 521851793 References: <37D2B3AB.CC6C91AF@teleline.es> Organization: Servidor NNTP de eb2ebu.ampr.org Newsgroups: es.comp.os.linux.programacion