On Fri, Sep 11, 2020 at 10:56:00PM -0300, Clark Morris wrote:
> [Default] On Wed, 09 Sep 2020 20:35:48 -0400, in bit.listserv.ibm-main
> Thomas David Rivers <[email protected]> wrote:
> 
> >> snip
> The way I read the code it is adding unsigned integers since only ADD
> LOGICAL instructions are used.  Handling numbers with different signs
> requires more complex code. 
> 
> Clark Morris

Hi Clark!

  The bit patterns that results from both an ADD and ADD LOGICAL
 will be the same... (for 2's complement signed representations) so
 the actual result value is identical.  The difference is the 
 treatment of the sign bit of that result by subsequent code,
 and the setting of the CC, and the possibility of a FIXED OVERFLOW exception.

  ADD UNSIGNED doesn't trigger the FIXED OVERFLOW exception, while
 SIGNED operations do.  Since C doesn't want FIXED OVERFLOW exceptions,
 (almost) all of the arithmetic calculations should be done with unsigned
 arithmetic in case the exception is accidently enabled in the CPU.

  So, as it turns out, there is no different code needed signed 
 addition or subtraction

        - Dave R. -

--
[email protected]                        Work: (919) 676-0847
Get your mainframe programming tools at http://www.dignus.com

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to