Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bitwise EXOR

1 view
Skip to first unread message

Herman Stevens

unread,
Sep 24, 1990, 1:52:29 AM9/24/90
to
Hello there !

I am a beginner with Modula-II. I work on an Amiga with the M2Amiga
compiler. I fail to see how I can do a bitwise EXOR, something you
can easily write in C as :

tmpbuf[i] = inbuf[i]^key[kp]

Can someone help me on this ?
Tnx,
Herman


--
uucp: uunet!m2xenix!puddle!2!292!601.21701!Herman.Stevens
Internet: Herman....@p21701.f601.n292.z2.fidonet.org

Peter Funk

unread,
Oct 1, 1990, 7:12:14 AM10/1/90
to
Herman....@p21701.f601.n292.z2.fidonet.org (Herman Stevens) writes:
[...]
hs> ......... I fail to see how I can do a bitwise EXOR, something you
hs> can easily write in C as :

hs> tmpbuf[i] = inbuf[i]^key[kp]

hs> Can someone help me on this ?

Bit-Operations are usually coded in Modula-2 using the Type BITSET:
Assume : VAR b1, b2, b3 : BITSET;

b3 := b1 * b2; <--> b3 <- b1 AND b2;
b3 := b1 + b2; <--> b3 <- b1 OR b2;
b3 := b1 - b2; <--> b3 <- b1 AND NOT b2;
b3 := b1 / b2; <--> b3 <- b1 XOR b2;

So your problem may be solved typing :
tmpbuf [i] := yourType (BITSET(inbuf [i]) / BITSET(key [kp]));
where 'yourType' is the element data type of 'tmpbuf'.

Gruss, Peter
-->
Peter Funk \\ ArtCom GmbH, Schwachhauser Heerstr. 78, D-2800 Bremen 1
Work at home: Oldenburger Str.86, D-2875 Ganderkesee 1 /+49 4222 6018 (8am-6pm)
>> PLEASE Don't send BIG mails (oversea) ! I've to pay for it : $0.3/kB
Don't use the bang path of this news article for mails (They will bounce).
Only the address 'p...@artcom0.north.de' will work. Thank You ! <<

0 new messages