Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Today is the first day of the rest of your lossage.


computers / comp.os.linux.advocacy / General Bitmask Operator

SubjectAuthor
o General Bitmask OperatorLawrence D'Oliveiro

1
General Bitmask Operator

<utqcim$kqor$3@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=12717&group=comp.os.linux.advocacy#12717

  copy link   Newsgroups: comp.os.linux.advocacy
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: ldo@nz.invalid (Lawrence D'Oliveiro)
Newsgroups: comp.os.linux.advocacy
Subject: General Bitmask Operator
Date: Sun, 24 Mar 2024 23:21:58 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <utqcim$kqor$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 25 Mar 2024 00:21:59 +0100
Injection-Info: dont-email.me; posting-host="4daea47f59346ad28e2d52cf9d13de71";
logging-data="682779"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19n/INcuvIjMeCZIE1cfP+W"
User-Agent: Pan/0.155 (Kherson; fc5a80b8)
Cancel-Lock: sha1:uck6eASmnZHWxEbubL5cC3zEchY=
 by: Lawrence D'Oliv - Sun, 24 Mar 2024 23:21 UTC

Here’s a generalized function that will implement any function that
takes two Boolean operands and returns a Boolean result. There are 16
possible such functions, and they are selected according to a mask
which defines the truth table:

bool bitmask_op
(
bool a,
bool b,
unsigned int mask
)
{
return
not a and not b and (mask & 1) != 0
or
not a and b and (mask & 2) != 0
or
a and not b and (mask & 4) != 0
or
a and b and (mask & 8) != 0;
} /*bitmask_op*/

Meanings of some mask values:

mask meaning
0 always false
1 nor
3 not-a (ignore b)
5 not-b (ignore a)
6 exclusive-or
7 nand
8 and
10 b (ignore a)
11 a implies b
12 a (ignore b)
13 b implies a
14 inclusive-or
15 always true

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor