Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch > #4775

Re: implementation of unsigned addition on one's complement machines

From anton@mips.complang.tuwien.ac.at (Anton Ertl)
Subject Re: implementation of unsigned addition on one's complement machines
Newsgroups comp.arch
References <1ca86407-1dbc-452c-af08-1f6d1bb76e24@u9g2000vbx.googlegroups.com>
Organization Institut fuer Computersprachen, Technische Universitaet Wien
Date 2011-11-15 17:26 +0000
Message-ID <2011Nov15.182620@mips.complang.tuwien.ac.at> (permalink)

Show all headers | View raw


Luca Forlizzi <luca.forlizzi@gmail.com> writes:
>How unsigned addition is implemented in one's complement CPUs? the
>instrucitons performing add in one's complement do not produce the
>correct result for unsigned addition. Do such CPUs have distinct add
>instructions for signed and unsigned operands?

If they want to use all the bits for unsigned numbers, then a separate
unsigned addition (and subtraction) is needed.  However, you can
define the positive subset of the signed integers supported by the
machine to be the unsigned numbers; then you can use the ordinary
(signed) addition for these "unsigned" numbers; but you don't get
wrap-around on overflows then.

I wonder how C's guaranteed wraparound on unsigned overflow is
implemented on such machines.

- anton
-- 
M. Anton Ertl                    Some things have to be seen to be believed
anton@mips.complang.tuwien.ac.at Most things have to be believed to be seen
http://www.complang.tuwien.ac.at/anton/home.html

Back to comp.arch | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

implementation of unsigned addition on one's complement machines Luca Forlizzi <luca.forlizzi@gmail.com> - 2011-11-14 07:08 -0800
  Re: implementation of unsigned addition on one's complement machines torbenm@diku.dk (Torben Ægidius Mogensen) - 2011-11-14 17:55 +0100
    Re: implementation of unsigned addition on one's complement machines torbenm@diku.dk (Torben Ægidius Mogensen) - 2011-11-15 10:29 +0100
      Re: implementation of unsigned addition on one's complement machines Luca Forlizzi <luca.forlizzi@gmail.com> - 2011-11-15 02:12 -0800
        Re: implementation of unsigned addition on one's complement machines nmm1@cam.ac.uk - 2011-11-15 10:28 +0000
          Re: implementation of unsigned addition on one's complement machines Luca Forlizzi <luca.forlizzi@gmail.com> - 2011-11-15 03:07 -0800
            Re: implementation of unsigned addition on one's complement machines nmm1@cam.ac.uk - 2011-11-15 11:13 +0000
              Re: implementation of unsigned addition on one's complement machines anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-15 17:33 +0000
                Re: implementation of unsigned addition on one's complement machines nmm1@cam.ac.uk - 2011-11-15 18:14 +0000
                Re: implementation of unsigned addition on one's complement machines anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-16 09:34 +0000
        Re: implementation of unsigned addition on one's complement machines Michael S <already5chosen@yahoo.com> - 2011-11-16 09:04 -0800
          Re: implementation of unsigned addition on one's complement machines nmm1@cam.ac.uk - 2011-11-16 17:31 +0000
          Re: implementation of unsigned addition on one's complement machines Robert Wessel <robertwessel2@yahoo.com> - 2011-11-16 11:54 -0600
    Re: implementation of unsigned addition on one's complement machines Luca Forlizzi <luca.forlizzi@gmail.com> - 2011-11-15 03:11 -0800
  Re: implementation of unsigned addition on one's complement machines anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2011-11-15 17:26 +0000
    Re: implementation of unsigned addition on one's complement machines Terje Mathisen <"terje.mathisen at tmsw.no"> - 2011-11-15 23:12 +0100
      Re: implementation of unsigned addition on one's complement machines Kai Harrekilde-Petersen <khp@harrekilde.dk> - 2011-11-15 23:25 +0100

csiph-web