Previous Topic Next topic Print topic


Optimizing Arithmetic Statements

For the best performance from arithmetic statements use simple two-operand arithmetic statements wherever possible. The following operations are optimized for COMP-5 and COMP-X data items up to four bytes long:

 MOVE a TO b 
 ADD a TO b 
 SUBTRACT a FROM b 
 MULTIPLY a BY b 
 DIVIDE a INTO b 
 IF a condition b

where:

a Is a numeric literal value or data item up to four bytes long.

b Is a numeric data item up to four bytes long.

On other data items, these simple operations result in faster code than more complex instructions, but the benefits are not as great as with COMP-5 or COMP-X items. More complex forms of these instructions, involving more than two operands, might not produce code which is as efficient as the simple form.

Other recommendations for optimizing arithmetic statements include:

Previous Topic Next topic Print topic