Use Constants of the Correct Type
As explained in
Constants and Variables, the syntax of a constant determines its type. Efficiency is adversely affected when the type of a constant must be converted during expression evaluation. Consider the following expression:
A + 5
If the variable A is of floating-point type, the constant 5 must be converted from short integer type to floating-point type each time the expression is evaluated.
The type of a constant also has an important effect in array expressions. Care must be taken to write constants of the correct type. In particular, when you are performing arithmetic on byte arrays and want to obtain byte results, be sure to use byte constants (e.g., nB). For example, if A is a byte array, the result of the expression A + 5B is a byte array, while A + 5 yields a 16-bit integer array.
Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.