Thread View: comp.lang.modula2
3 messages
3 total messages
Started by chris
Tue, 27 Feb 1996 05:22
xor procedure for M-2
Author: chris
Date: Tue, 27 Feb 1996 05:22
Date: Tue, 27 Feb 1996 05:22
10 lines
705 bytes
705 bytes
if someone could give me a simple way to write a program to compute the value of xors in modula2 it would be appreciated.\ like a function that returns the decimal value 26 for xor(12, 22) (12 xor 22) later send to emial
Re: xor procedure for M-2
Author: "Mark Morgan Lloyd "
Date: Tue, 27 Feb 1996 14:01
Date: Tue, 27 Feb 1996 14:01
39 lines
1199 bytes
1199 bytes
>
>
> if someone could give me a simple way to write a program to
compute
> the value
> of xors in modula2 it would be appreciated.\
>
> like a function that returns the decimal value 26 for xor(12, 22)
> (12 xor 22)
>
> later
> send to emial
>
<sigh>
Article: 7435 of comp.lang.modula2
Newsgroups: comp.lang.modula2
Subject: Re: XOR function
Organization: KDG Mobrey Telemetry
References: <1996Feb8.114044.15072@ucl.ac.uk>
X-News-Software: Ameol
MODULE Demo;
VAR a, b, c: CARDINAL;
BEGIN
IF SIZE(CARDINAL) <> SIZE(BITSET) THEN (* Paranoid? Me? *)
UserBreak
END;
c:= CARDINAL(BITSET(a) / BITSET(b))
END Demo.
Mark Morgan Lloyd
mark_tbu@cix.compulink.co.uk
[Opinions above are the author's, not those of his employers or
colleagues]
Re: xor procedure for M-2
Author: Peter Moylan
Date: Thu, 29 Feb 1996 23:32
Date: Thu, 29 Feb 1996 23:32
18 lines
1126 bytes
1126 bytes
chris (francosky.1@postbox.acs.ohio-state.edu) wrote:
> if someone could give me a simple way to write a program to
> compute the value
>of xors in modula2 it would be appreciated.\
This sounds like a homework problem, so I won't give a
complete answer; but here are some hints:
Method 1: depending on the compiler you're using, there might
be an xor function in the library.
Method 2: type-casting to BITSET.
--
Peter Moylan peter@ee.newcastle.edu.au
http://www.eng.newcastle.edu.au/ee/Moylan.html
OS/2 freeware list at
http://www.eng.newcastle.edu.au/ee/Moylan/os2/os2info.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads