Re: copy-bit macro

Michael Elizabeth Chastain (mec@shout.net)
Wed, 10 Dec 1997 09:56:13 -0600


Stephen Williams writes:

> if (input & INPUT_FLAG_FOO)
> output |= OUTPUT_FLAG_FOO;
> if (input & INPUT_FLAG_BAR)
> output |= OUTPUT_FLAG_BAR
> if (input & INPUT_FLAG_BAZ)
> output |= OUTPUT_FLAG_BAZ
>
> Seems to me, this specific example can be reduced to
> output |= input & (INPUT_FLAG_FOO|INPUT_FLAG_BAR|INPUT_FLAG_BAZ);

Only if INPUT_FLAG_FOO == OUTPUT_FLAG_FOO, which, generally, it isn't.

Michael Chastain
<mailto:mec@shout.net>
"love without fear"