Next: , Previous: Specific Types for Color and Precision, Up: Datatypes


3.3 Color and Precision Uniformity

In standard coding practice it is assumed that a user keeps one of the precision and color options in force throughout the compilation. So as a rule all functions in the interface take operands of the same precision and color. As with data type names, function names come in generic and color- and precision-specific forms, as described in the next section. Exceptions to this rule are functions that explicitly convert from double to single precision and vice versa. These and functions that do not depend on color or precision are divided among thirteen separate libraries. If the user chooses to adopt color and precision uniformity, then all variables can be defined with generic types and all functions accessed through generic names. The prevailing color and precision is then defined through macros. The interface automatically translates data type names and function names to the appropriate specific type names through typedefs and macros. With such a scheme and careful coding, changing only two macros and the QDP library converts code from one color and precision choice to another.