Bill -

Good thought. Let's see

FFFFFFFF (-1) anded becomes
7FFFFFFF (2147483647) divided by 256 becomes
007FFFFF (8388607) and oring the bit back gives
00FFFFFF QED

FFFFFE00 (-512) anded becomes
7FFFFE00 (2147483136) divided by 256 becomes
007FFFFE (8388606) and oring the bit back gives
00FFFFFE QED

Maybe that will work. Thanks! Comments anyone?

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On Behalf
Of Bill Godfrey
Sent: Wednesday, February 21, 2007 3:03 PM
To: [email protected]
Subject: Re: Simulating SRL in integer arithmetic

I see it's not as simple as I thought. Maybe if it's negative, zero the 
sign bit with an "And", divide by 256, then "Or" the quotient with hex 
00800000 to recover the dropped bit.

>On Wed, 21 Feb 2007 10:48:10 -0800, Charles Mills wrote:
>
>>        ' Simulate a shift right logical 8
>>        If R6 >= 0 Then
>>            R6 = R6 \ 256     ' \ is integer division
>>        Else
>>            R6 = R6 \ 256   ' \ is integer division
>>            R6 = R6 - 1
>>            R6 = R6 And &HFFFFFF        ' Equivalent to S/390 X'FFFFFF'
>>            End If

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to