Purpose |
Converts an
| ||||||||||||
Syntax |
resultvar = BITS(datatype, expression) | ||||||||||||
datatype |
The parameter datatype may be BYTE, WORD, DWORD, INTEGER, or LONG to specify the new data type which should be returned by the function. | ||||||||||||
expression |
An integer class variable, expression, or numeric literal, which designates the original value to be converted. | ||||||||||||
Remarks |
Since the integer value -1 and word value 65535 have the identical bit pattern of 1111111111111111, BITS(WORD,-1) would return the unsigned word value of 65535. Of course, BITS(INTEGER,65535) would then return the integer value -1. Other values and data types would follow the same pattern and rules. This newer form of BITS condenses the functionality of the older forms (BITS%, BITS&, BITS?, BITS?? and BITS???) into a single function. In particular, this provides for the addition of new data types in future version of PowerBASIC, particularly those which may not have an associated type-specifier character. | ||||||||||||
Restrictions |
The superseded syntax will continue to be supported for a limited period of time, although existing code should be converted to the new syntax as soon as possible.
| ||||||||||||
See also |
BIT CALC statement, BIT function, BIT statement, BITS functions, BITSE |