Re: C question about bitmasks in datetime.c

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: C question about bitmasks in datetime.c
Date: 2013-10-01 15:17:35
Message-ID: 20131001151735.GD3001247@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-10-01 11:15:36 -0400, Bruce Momjian wrote:
> I see a few cases of this code in src/backend/utils/adt/datetime.c:
>
> else if ((fmask & DTK_DATE_M) != DTK_DATE_M)
>
> Wouldn't this be clearer as:
>
> else if (fmask & DTK_DATE_M)

That doesn't have the same meaning. The latter is trueif only one bit of
DTK_DATE_M is set, while the former requires all bits to be set.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2013-10-01 15:24:41 Re: C question about bitmasks in datetime.c
Previous Message Bruce Momjian 2013-10-01 15:15:36 C question about bitmasks in datetime.c