|
>Date: Mon, 14 Jan 2002 10:34:40 -0500
>From: "Mike Naughton" <mnaughton@juddwire.com>
>
>I'm trying to join the twentieth century here and replace all my MOVEs
>with EVALs, but this one has me stuck. If I have a 9-element array RA and
>I want to fill the last three elements with, say, "X", I can code:
>
>MOVEA *ALL('X') RA(7)
>
>Is there a way I can do the same thing using EVAL?
Here's one way:
C for i = 7 to %elem(RA)
C eval RA(i) = *all'X'
C endfor
Here's another way that will probably perform somewhat better,
if the number of elements is very large (which it's not in
your case):
D data s 65535a based(pData)
D pData s *
C eval pData = %addr(RA(7))
C eval numElems = %elem(RA) - 7 + 1
C eval %subst(data : 1 : %size(RA) * numElems)
C = *ALL'X'
Mike, in an earlier thread, I made the bold claim that MOVEA was
a useless opcode, now that the string builtins are so powerful.
I challenged the mailing list to come up with a reasonable use
for MOVEA. Do we have a candidate here? What's the problem
being solved by setting those elements to 'X'?
Barbara Morris
This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.