Re: Bitmask trickiness - Mailing list pgsql-general

From Stephen Cook
Subject Re: Bitmask trickiness
Date
Msg-id 4C494957.7070209@gmail.com
Whole thread Raw
In response to Re: Bitmask trickiness  (Howard Rogers <hjr@diznix.com>)
Responses Re: Bitmask trickiness  (Howard Rogers <hjr@diznix.com>)
List pgsql-general
On 7/23/2010 2:38 AM, Howard Rogers wrote:
>>> Still doesn't answer the precise, specific technical question I
>>> >>  actually asked, though, does it?!
>> >
>> >  Which was answered by Stephen Cook was it not?  I.e. use plain old equals?
> Maybe I should assume you haven't read the thread, then?! God knows
> what that answer even actually meant, but hopefully you read my reply
> where I pointed out that it's no answer at all. 21205&  4098 = what,
> precisely? Never mind: another rhetorical question. Plain old equals
> doesn't come close.
>

Hate to interrupt your flame war, and I apologize for not being precise
in my meaning first try... You don't need any bitwise anything to
compare two bitmasks-hiding-in-integers, just check for equality.

Instead of "select * from coloursample where colour & 10 = 10;" just try
"select * from coloursample where colour = 10;".

If you want to probe for two values, that MUST be in there, and WITHOUT
anything else, bitwise OR them together as the probe value and use plain
old equals there too. You only need the bitwise AND stuff for checking
for a value that MUST be in there, regardless of whether or not other
values are in there as well.

Hope I was clearer this time. Originally I just fired off a quickie
email to get you past your coder's block.

-- Stephen

pgsql-general by date:

Previous
From: Howard Rogers
Date:
Subject: Re: Bitmask trickiness
Next
From: Alban Hertroys
Date:
Subject: Re: Bitmask trickiness