whole number, integer, whole number
Source: /avail/Avail/Foundation/Bootstrap/Fallible Primitives
Categories: Primitives, Numbers, Integers, Mathematics, Bits
Shift baseInteger to the left by shiftFactor bits (treating a negative factor as a right shift), then truncate the result to the bottom truncationBits bits by zeroing the rest.
Position | Name | Type | Description | |
---|---|---|---|---|
Parameters | ||||
1 | baseInteger | whole number | A non-negative integer to shift and mask. | |
2 | shiftFactor | integer | How many bit positions to shift left by (negative for a right shift). | |
3 | truncationBits | whole number | The number of low-order bits to preserve after the shift (must be ≥ 0). | |
Returns | [0..∞) | ⎣_<<_keeping_bits × 2^{baseInteger}⎦ mod 2^{shiftFactor} | ||
Raises | ||||
shift-and-truncate-requires-non-negative exception | ||||
too-large-to-represent exception |