nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

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

Von: Cybertoldo (cybertoldo@moc.liamg) [Profil]
Datum: 22.01.2007 15:00
Message-ID: <ep2g1v$apt$1@registered.motzarella.org>
Newsgroup: it.comp.lang.c
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.


--
Cybertoldo

Per rispondermi via email, sostituisci moc.liamg con gmail.com

[ Auf dieses Posting antworten ]

Antworten