Article View: comp.lang.modula2
Article #3292Re: XOR function
From: Martin Tom Brown
Date: Fri, 16 Feb 1996 11:23
Date: Fri, 16 Feb 1996 11:23
32 lines
1877 bytes
1877 bytes
In article <533335858wnr@bcmrtc.demon.co.uk>
Rupert@bcmrtc.demon.co.uk "Rupert Toncic" writes:
> In article: <4fn5qu$ejm@nyheter.chalmers.se> Bengt-Inge Dalenback
> <bid@ta.chalmers.se> writes:
> > Low-level tricks like that can be done using SET operations. XOR is "/"
> > which means for A, B and C CARDINALs:
> >
> > "C = A XOR B" <=> C := CARDINAL( BITSET(A) / BITSET(B) );
> >
> > Check out the "TopSpeed Language Tutorial" on SETs in case I remembered
> > it wrong. TopSpeed also has a "bitwise boolean operator" pragma that
> > sometimes
> > can be handy but which of course is nonportable.
>
> It may also me much quicker to use the assembly language routine.
> You could use the Visual Debuger to view the asam code and see
> which is the quickest. XOR as a machine instrction between to
> 16 bit registers is about 2 clock cycles.
At least on the JPI compiler all bitset operations compile to the
appropriate 80x86 instructions so no need to use ASM for this.
I have always been very impressed with their code generator.
IIR Logitech compiler was a bit weak in this area.
(It may have improved recently I no longer use it)
Regards,
--
Martin Brown <martin@nezumi.demon.co.uk> __ CIS: 71651,470
Scientific Software Consultancy /^,,)__/
Technical Details
Message-ID:
<824469801snz@nezumi.demon.co.uk>Path:
arc1-ca.pugleaf.net!mail2news.demon.co.uk!nezumi.demon.co.ukReferences:
<1996Feb8.114044.15072@ucl.ac.uk> <4fn5qu$ejm@nyheter.chalmers.se> <533335858wnr@bcmrtc.demon.co.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!nezumi.demon.co.uk From: Martin Tom Brown <Martin@nezumi.demon.co.uk> Newsgroups: comp.lang.modula2 Subject: Re: XOR function Date: Fri, 16 Feb 96 11:23:21 GMT Organization: Nezumi Message-ID: <824469801snz@nezumi.demon.co.uk> References: <1996Feb8.114044.15072@ucl.ac.uk> <4fn5qu$ejm@nyheter.chalmers.se> <533335858wnr@bcmrtc.demon.co.uk> Reply-To: Martin@nezumi.demon.co.uk X-NNTP-Posting-Host: nezumi.demon.co.uk X-Newsreader: Demon Internet Simple News v1.29 X-Mail2News-Path: nezumi.demon.co.uk