From: Damian Yerrick Newsgroups: comp.os.msdos.djgpp Subject: Re: odd or even? Organization: Pin Eight Software http://pineight.8m.com/ Message-ID: References: <38BE28A9 DOT CD476C62 AT student DOT kuleuven DOT ac DOT be> <38BE4B85 DOT 1F5A0778 AT videotron DOT ca> <38BE7E6D DOT 6FE78AC9 AT americasm01 DOT nt DOT com> <89to3c$1th$1 AT antares DOT lu DOT erisoft DOT se> <38C3C541 DOT 2E113E7D AT americasm01 DOT nt DOT com> X-Newsreader: Forte Agent 1.7/32.534 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 40 X-Trace: +r2abgGdHaJec5Sf+mMqjgdiiPB0aQUXRO4XoA3TRRirntL3tLPvNu22oHbArn2gAj4zgMZ6BBqk!ZFa3GqVN+gyYEp2pFKGYhUAhdORlEwD6wL9EeGdST7n8weVUGDxjtF5uDD/eeDRiICwLZK+2+ydL!opmEUAY= X-Complaints-To: abuse AT gte DOT net X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly NNTP-Posting-Date: Mon, 06 Mar 2000 22:43:24 GMT Distribution: world Date: Mon, 06 Mar 2000 22:43:24 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com On Mon, 06 Mar 2000 09:48:33 -0500, "Campbell, Rolf [SKY:1U32:EXCH]" wrote: >Martin Stromberg wrote: > >> : >It should work fine with signed integers.... >> : >-1 = 0xFFFFFFFF (lowest bit set) >> : >-2 = 0xFFFFFFFE (lowest bit not set) >> >> : Might not work on other machines, though. (I honestly don't know, >> : I've never used a machine that wasn't 2's-complement) >> >> One's complement works as well: >> +0 = 0x00000000 (lowest bit not set) >> -0 = 0x80000000 (lowest bit not set) >> -1 = 0x80000001 (lowest bit set) >> -2 = 0x80000002 (lowest bit not set) (That's not ones' complement; that's sign bit.) >> What other interesting representations are there? > > Well, I've heard of a format where you only had to flip 1 bit to >increment or decrement any integer. Gray-like code. Useful for encoding states in hardware finite state machines and for reading the rotation of a shaft. >But I don't know if anyone actually make a processor for it. It's usually done with lookup tables from Gray to 2's. -- Damian Yerrick http://yerricde.tripod.com/ Comment on story ideas: http://home1.gte.net/frodo/quickjot.html AOL is sucks! Find out why: http://anti-aol.org/faqs/aas/ View full sig: http://www.rose-hulman.edu/~yerricde/sig.html This is McAfee VirusScan. Add these two lines to your .sig to prevent the spread of .sig viruses. http://www.mcafee.com/