Herman.Stev
...@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 '...@artcom0.north.de' will work. Thank You ! <<