o_BitShiftLeftTruncatingToBits

open override fun o_BitShiftLeftTruncatingToBits(    self: AvailObject,     shiftFactor: A_Number,     truncationBits: A_Number,     canDestroy: Boolean): A_Number

Shift the given positive number to the left by the specified shift factor (number of bits), then truncate the representation to force bits above the specified position to be zeroed. The shift factor may be negative, indicating a right shift by the corresponding positive amount, in which case truncation will still happen.

For example, shifting the binary number 1011₂ to the left by 2 positions will produce 101100₂, then truncating it to, say 5 bits, would produce 01100₂. For a second example, the positive number 110101₂ can be shifted left by -2 positions (which is a right shift of 2) to get 1101₂, and a subsequent truncation to ten bits would leave it unaffected.

Return

⌊object × 2^shiftFactor⌋ mod 2^truncationBits

Parameters

self

The non-negative integer to shift and mask.

shiftFactor

How much to shift left (may be negative to indicate a right shift).

truncationBits

A positive integer indicating how many low-order bits of the shifted value should be preserved.

canDestroy

Whether it is permitted to alter the original object if it happens to be mutable.