Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!samsung!munnari.oz.au!metro!cluster!steve From: steve@cs.su.oz (Stephen Russell) Newsgroups: comp.lang.modula2 Subject: Re: Bitwise EXOR Message-ID: <1230@cluster.cs.su.oz.au> Date: 30 Sep 90 15:05:23 GMT Sender: news@cluster.cs.su.oz.au Reply-To: steve@cluster.cs.su.oz (Stephen Russell) Organization: Basser Dept of Computer Science, University of Sydney, Australia Lines: 18 Herman Stevens asks: >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 ? It ain't as simple as in C (but then neither are bit-ands and ors). Try using the symmetric set difference operator by casting. Something like this might work: tmpbuf[i] := CARDINAL(BITSET(inbuf[i]) / BITSET(key[kp])) You may have to fiddle with the appropriate set types to get this past the compiler, but hopefully you get the idea. Cheers