Re: Bitmask trickiness

From: John R Pierce <pierce(at)hogranch(dot)com>
To: Howard Rogers <hjr(at)diznix(dot)com>
Cc: Stephen Cook <sclists(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Bitmask trickiness
Date: 2010-07-23 16:52:22
Message-ID: 4C49C8C6.5040803@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

the universal solution is a AND with one mask (which has a 1 in every
position you wish to test for and a zero in each position you wish to
ignore) and an XOR with another mask (that has a 1 in each position that
you want to test for a 1 and a zero in each position that you wish to
test for a 0)), then a test if the result is == zero.

in a language like SQL, this could be simplified to a AND with MASK1 and
a COMPARE for equality with MASK2, with the same result.

-jrp
(old assembler programmer)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2010-07-23 16:54:27 Re: Can WAL files be shipped to multiple servers?
Previous Message Steeles 2010-07-23 16:36:41 Re: Can WAL files be shipped to multiple servers?