269 of 323
ZBasic System Library 259 ZX Microcontroller Family Shr Type Function returning the same type as the first parameter. Invocation Shr(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 right 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 = Shr(i, 2) ' result will be 5 Compatibility This function is not available in BasicX compatibility mode. See Also Shl