Article View: gnu.gcc.help
Article #469Unsigned support on a signed machine
From: Michael Gersten
Date: Sat, 10 Oct 1992 19:56
Date: Sat, 10 Oct 1992 19:56
19 lines
1265 bytes
1265 bytes
I have a machine that assumes that everything done is signed. For example, addition always produces a fixed point overflow exception if the sign is wrong. This makes the unsigned data type hard to support. For math, I'm just extending everything to long (or more accurately, letting the compiler do the extending to long), and doing the signed operation in that mode; this will fail in the (hopefully uncommon) case of two large unsigned numbers being added together (which would overflow anyways). The real problem is with conditional jumps. The only comparison operation sets less than, equal, or greater, based on a signed comparison; the subtract instruction will set carry, but it also causes an overflow exception. Any ideas on how to support unsigned data on this machine? (Aside from turning off the overflow trap, which isn't an option). Michael
Technical Details
Message-ID:
<m0mdmvM-0005OXC@stb.info.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!stb.INfo.COM!michaelShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!stb.INfo.COM!michael From: michael@stb.INfo.COM (Michael Gersten) Subject: Unsigned support on a signed machine Message-ID: <m0mdmvM-0005OXC@stb.info.com> Sender: daemon@cis.ohio-state.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sat, 10 Oct 1992 19:56:00 GMT Lines: 19