[Info-vax] Whither VMS?
glen herrmannsfeldt
gah at ugcs.caltech.edu
Fri Oct 9 18:20:16 EDT 2009
JF Mezei <jfmezei.spamnot at vaxination.ca> wrote:
< VAXman- @SendSpamHere.ORG wrote:
<> Consider the MOVCx a macro or routine.
< Moving data isn't the on,y thing one does with strings. You also want to
< scan through them, find the last non-blank characters, compress the
< string to remove duplicate blanks (or all blanks), test validity of
< string (postal code for instance), uppercase it, and check for a substring.
Yes, all of those.
< All of those operations require you scan through the string, at which
< point, the loop that scans the string can be more efficient with a null
< termkinated string compared to a counted string.
You are making a lot of assumptions about the processor your
program runs on. It may or may not have efficient ways to do
those operations on either type of string.
Many operations require counts, so instructions that know how
to count have been very popular.
Finding the first non-blank character requires only a linear
search from the beginning. VAX has SCANC which may or may not
do that fast. Finding the last non-blank is easiest done from
the end, which is easier for counted strings. VAX doesn't seem
to have any instructions for searching backwards.
For the PDP-11 I probably believe null termination is faster.
Not for most other processors. For S/360, for example, you
would have add a specific test as IC, I believe, doesn't set
the flag bits. For S/370, ICM does, but it may or may not
be faster. You still need some type of loop for those, which
might just as well index the characters.
-- glen
More information about the Info-vax
mailing list