On Sun, 29 Apr 2007 13:55:24 -0300, Shmuel Metz (Seymour J.)
<[EMAIL PROTECTED]> wrote:
>...
>*All* instructions should be used with care and with adequate
>documentation. You don't need new instructions to write obscure
code;
>it's been done with BXH and BXLE.
>...
>From a binary search routine I inherited about 35 years ago.
This calulates the offset of the middle element of a table FSVO middle.
r2 = table entry length
r3 = (non-zero) table length
BXLE R2,R2,* DOUBLE OFFSET UNTIL >TAB SIZE
SRL R2,1 GET MIDDLE ELEMENT
It works. It might even be efficient for small tables. But BXLE is
not an instruction I associate with numerical calculations.
It also has a BXH a few instructions later used for calculation and
loop control (but a bit more obvious than "R2,R2,*").
And the code came with no comments.
Pat O'Keefe
----------------------------------------------------------------------
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