home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #23 / NN_1992_23.iso / spool / gnu / gcc / help / 2299 < prev    next >
Encoding:
Text File  |  1992-10-10  |  1.2 KB  |  31 lines

  1. Newsgroups: gnu.gcc.help
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!stb.INfo.COM!michael
  3. From: michael@stb.INfo.COM (Michael Gersten)
  4. Subject: Unsigned support on a signed machine
  5. Message-ID: <m0mdmvM-0005OXC@stb.info.com>
  6. Sender: daemon@cis.ohio-state.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Sat, 10 Oct 1992 19:56:00 GMT
  10. Lines: 19
  11.  
  12.  
  13. I have a machine that assumes that everything done is signed.
  14. For example, addition always produces a fixed point overflow
  15. exception if the sign is wrong. This makes the unsigned data
  16. type hard to support. For math, I'm just extending everything
  17. to long (or more accurately, letting the compiler do the extending
  18. to long), and doing the signed operation in that mode; this will
  19. fail in the (hopefully uncommon) case of two large unsigned numbers
  20. being added together (which would overflow anyways). 
  21.  
  22. The real problem is with conditional jumps. The only comparison
  23. operation sets less than, equal, or greater, based on a signed
  24. comparison; the subtract instruction will set carry, but it also
  25. causes an overflow exception.
  26.  
  27. Any ideas on how to support unsigned data on this machine? (Aside
  28. from turning off the overflow trap, which isn't an option).
  29.  
  30.         Michael
  31.