[Zlib-devel] setting flags in zutil.c

Glenn Randers-Pehrson glennrp at comcast.net
Sun Jul 24 07:23:56 EDT 2005


zutil.c has 28 instances of setting flags, using the following form:

    flags += 1L << N;

I think it is safer to use "|=" instead of "+=".  The former does
the right thing even if the flag is already set for some reason,
while "+=" would unset the flag and mess up the higher bits of "flags".

Glenn





More information about the Zlib-devel mailing list