nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Re: Lavorare con Shift,Bit,Maschera And or etc.

Von: yappo (yappo2@sistrix.com) [Profil]
Datum: 23.01.2007 09:20
Message-ID: <45b5cba4$0$16398$4fafbaef@reader4.news.tin.it>
Newsgroup: it.comp.lang.c

"Cybertoldo" <cybertoldo@moc.liamg> ha scritto nel messaggio
news:ep2g1v$apt$1@registered.motzarella.org...
> cane ha scritto:
>> e in questo "ricettario":
>>
>> http://graphics.stanford.edu/~seander/bithacks.html
>
> ...carino questo link.
>
> Mi ha fatto anche ricordare un classico vecchio quiz che girava tra
> studenti o colleghi di lavoro: :)
>
> Swapping values with XOR
>
> #define SWAP(a, b) (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))
>
> This is an old trick to exchange the values of the variables a and b
> without using extra space for a temporary variable.
>
Ottimo grazie a tutti, il fatto e che se me le studio le cose le
capisco ma poi non usandole mi dimentico un sacco di cose...
Quindi volevo farmi una mini dispensina di tutti i tricks...



[ Auf dieses Posting antworten ]

Antworten