Page 1 of 1 1
Topic Options
#80050 - 2001-05-01 04:05 PM I would like a Bitwise XOR function
Anonymous
Unregistered


Currently AND, OR and NOT are boolean (returning 1 or 0),and & and | are bitwise.
A bitwise 'Exclusive OR' would help in setting/clearing bitfields (used in file properties and Windows Dialog boxes etc)
(Any suggestions on a symbol to represent it?)

Top
#80051 - 2001-05-01 04:10 PM Re: I would like a Bitwise XOR function
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
How about ^

Shawn.

Top
#80052 - 2001-05-01 06:03 PM Re: I would like a Bitwise XOR function
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
Excellent idea. If you need an X(n)OR function in the meantime, try this:

$eCode=chr((asc($sCode) & $iEncrypt) | (255-(asc($sCode) | $iEncrypt)))

if Z = A xor B then $eCode = $sCode xor $iEncrypt.

cj

[This message has been edited by cj (edited 01 May 2001).]

Top
#80053 - 2001-05-03 12:34 AM Re: I would like a Bitwise XOR function
Anonymous
Unregistered


If all you want to do is set and reset bits you don't need an XOR function, as the & and | perform those functions. XOR would be more suited to toggling bits.
Top
#80054 - 2001-05-02 07:13 PM Re: I would like a Bitwise XOR function
Anonymous
Unregistered


Is it me, or does cj's code return the inverse of the xor result?
if $A = %1010
$B = %1100
then =====
$A xor $b = %0110

so I think the code should be:
$Z = ($A | $B) & (-1 -($A & $B))

Top
#80055 - 2001-05-03 12:01 AM Re: I would like a Bitwise XOR function *DELETED*
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
Post deleted by kholm
Top
#80056 - 2001-05-03 01:19 AM Re: I would like a Bitwise XOR function
cj Offline
MM club member
*****

Registered: 2000-04-06
Posts: 1102
Loc: Brisbane, Australia
AJH, it is not you, that is an XNOR function

Thanks for the XOR version

cj

Top
#80057 - 2001-05-19 11:14 AM Re: I would like a Bitwise XOR function
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Well most of you guys seem to be more of programmers then Admins...
Perhaps ones that have turned into LAN/WAN Administrators.
Here is a link to another site that has some more information on this stuff that may help
the rest of us to learn more.
http://www.logicalexpressions.com/vbtip.htm

------------------
NTDOC...
The dark side is quicker, easier, more seductive.

If you choose the quick and easy path, you will become an agent of evil.

Top
#80058 - 2005-08-19 01:36 AM Re: I would like a Bitwise XOR function
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
this is an old thread or actually topic but.
in 4.50 your wishes came trough.

long after the termination of your user account though...
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Lonkero, ShaneEP, Jochen, Radimus, Glenn Barnas, Allen, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 718 anonymous users online.
Newest Members
Timothy, Jojo67, MaikSimon, kvn317, kixtarts2025
17874 Registered Users

Generated in 0.036 seconds in which 0.014 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org