Re: bit operations

From: Oliver Vecernik <vecernik(at)aon(dot)at>
To: "Randal L(dot) Schwartz" <merlyn(at)stonehenge(dot)com>
Cc: Johan Björk <johan(at)websidorna(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: bit operations
Date: 2001-07-05 08:10:24
Message-ID: 3B4420F0.57080139@aon.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Randal L. Schwartz" wrote:
>
> >>>>> "Oliver" == Oliver Vecernik <vecernik(at)aon(dot)at> writes:
>
> >> Say I wanna check if 8 (1xxx) and 2 (xx1x) is set, how do I do that?!
>
> Oliver> Sorry, I didn't read the whole question first:
>
> Oliver> select * from table where ((flags & 8) <> 0) and ((flags & 2) <> 0);
>
> In the old days, we spelled that as flags & 10 = 10. :) Wouldn't that
> work just as well?

As far as I know testing for <> 0 could be calculated faster. Does
anybody know if this is true?

Regards,
Oliver

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-07-05 08:41:26 Re: postgres and unix time format
Previous Message Colin Taylor 2001-07-05 07:08:55 RE: Table Description!!