![]() ZBasic System Library
289
ZBasic Microcontrollers
Type
Function returning the same type as the first parameter.
Invocation
Shl(val, shiftCnt)
Parameter
Method
Type
Description
val
ByVal
integral
The value to be shifted.
shiftCnt
ByVal
int8/16
The number of bit positions to shift (0-16).
Discussion
This function returns the value provided as the first parameter but shifted left the number of bit positions
specified by the second parameter. If the shiftCnt is zero, the value is returned unchanged. If the
shiftCnt is greater than or equal to the number of bits in the value provided, the return value will be
zero. For signed types, the sign of the result will be the same as that of the provided value.
The type of the return value will be the same as the type of the first parameter.
Example
Dim i as Integer, j as Integer
i = 23
j = Shl(i, 5)
' result will be 736
Compatibility
This function is not available in BasicX compatibility mode.
See Also
|