|
Numeric Constants |
Top Previous Next |
|
Several different kinds of numeric constant are available to meet the different uses of constants within the configuration language. For example, a constant may be expressed in decimal notation or in hexadecimal.
A special notation is provided to extend a decimal constant with a scaling letter; this is most commonly used in specifications of memory allocation. The scaling letters K and M scale the decimal constant they follow by 1024 and 1024×1024 (1048576) respectively. Note that it is not possible to add a scaling letter to a hexadecimal constant; the configurer would interpret such a combination as the hexadecimal constant followed by a single-character word containing the scaling letter.
Although all numeric constants in the configuration language represent integer values, a representation including a decimal point can be used for input: the number is simply truncated towards zero before use. For example, 1.6 would simply represent 1. Because this truncation occurs after the scaling letter, if any, has been applied, the decimal point can be used to express fractions of the scaling value. For example, 1.6M would represent 1677721, which is the truncated integer part of 1.6×1024×1024.
When a constant is used to refer to an amount of memory, it may express a number of words or octets, depending on the processor. For example, on the C6000, such quantities always refer to a number of octets (eight-bit bytes).
constant = decimal constant | hex constant; hex constant = "0x", hex digits; hex digits = hex digit, {hex digit}; hex digit = digit | "A" | … | "F"; decimal constant = decimal digits, [".", {decimal digit}], [scaling letter]; scaling letter = "K" | "M"; decimal digits = decimal digit, {decimal digit}; decimal digit = "0" | … | "9";
Some examples of numeric constants are given here with their values in decimal.
|