Re^2: Bit Switching - How?

Maarten Litmaath maart at cs.vu.nl
Thu Apr 13 10:13:11 AEST 1989


dg at lakart.UUCP (David Goodenough) writes:
\#define	swap(a, b, n)	((a) ^= ((b) & (n)), (b) ^= ((a) & (n)), \
\							(a) ^= ((b) & (n)))

This one still suffers from the following:

	swap(*p, *q, ~0);

where p and q point at the same location.
-- 
 "If it isn't aesthetically pleasing, |Maarten Litmaath @ VU Amsterdam:
  it's probably wrong." (jim at bilpin). |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.questions mailing list