Boost logo

Boost :

Subject: Re: [boost] [PATCH 2/2] Fixed warning: use of logical && with constant operand; switch to bitwise & or remove constant [-Wconstant-logical-operand]
From: Dave Abrahams (dave_at_[hidden])
Date: 2010-12-21 13:21:00


At Tue, 21 Dec 2010 11:50:34 +0200,
Vasyl' wrote:
>
> ---
> boost/uuid/name_generator.hpp | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
> diff --git a/boost/uuid/name_generator.hpp b/boost/uuid/name_generator.hpp
> index 42473a6..507f8e8 100644
> --- a/boost/uuid/name_generator.hpp
> +++ b/boost/uuid/name_generator.hpp
> @@ -71,10 +71,10 @@ private:
>
> for (size_t i=0; i<count; i++) {
> uint32_t c = characters[i];
> - sha.process_byte( (c >> 0) && 0xFF );
> - sha.process_byte( (c >> 8) && 0xFF );
> - sha.process_byte( (c >> 16) && 0xFF );
> - sha.process_byte( (c >> 24) && 0xFF );
> + sha.process_byte( (c >> 0) & 0xFF );
> + sha.process_byte( (c >> 8) & 0xFF );
> + sha.process_byte( (c >> 16) & 0xFF );
> + sha.process_byte( (c >> 24) & 0xFF );
> }
> }

Ouch; nasty bug; thanks for the fix!

We don't normally take patches this way, though. Would you mind
entering it in the Trac at http://svn.boost.org/trac/boost ?

Thanks,

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk