On Mon, 29 Apr 2013 10:50:25 -0400, John Gilmore wrote: >It is not at all a bad subroutine. In many contexts the form of the >second argument would be gratuitously clumsy, but this routine was >(almost certainly) intended to be called from COBOL, and eight '0' or >'1' characters is appropriate for COBOL. > >I would not myself have used assembler mnemonics, whicjh are not very >perspicuous for COBOL programmers, to identify which operation is to >be performed,;and linear search is not the best way to identify which >of them has been supplied; but these are quibbles. > I might have avoided the search entirely by providing separate entry points for the various functions. It seems unlikely to me that a programmer would want to choose at runtime which function to perform.
Has the z nowadays any memory protection mode that forbids fetching instructions from data storage? (Many other processors have such.) But what's the break-even between linear search and binary search? I suspect that it's at about a handful. And linear search is probably friendlier to branch prediction logic than binary search. -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
