I also use the CL to catch negatives. One of those tricks I got from
this list.

Why the LTR? I don't know. I guess the reason is that I don't hardly
ever use an 'and' so I failed to notice that NR set the correct
condition code when I wrote this many years ago.

Tony Thigpen


-----Original Message -----
 From: Gerhard Postpischil
 Sent: 08/27/2012 02:29 PM
On 8/27/2012 1:19 PM, Tony Thigpen wrote:
Your code requires 2 scratch registers. The following uses just 1
scratch register and does not require literal storage:

   LA R0,3
   NR R0,R15
   LTR R0,R0
   BNZ BAD_RC

Why do you need the LTR? NR sets the condition code.

When I bother to add check code (mostly non-IBM calls), I use
        CL      R15,=A(maxvalue)
        BH      error

this test catches negative returns as well.


Gerhard Postpischil
Bradford, VT


Reply via email to