functionbitShiftRight
n >> k
Extends from Function (Icon for functions).
Information
This information is part of the Business Simulation Library (BSL). Please support this work and ► donate.
The output res corresponds to the binary bits of the input n shifted k places to the right.
Syntax
Functions.intBitShiftRight(n); // k = 1 Functions.intBitShiftRight(n,k);
Implementation
res := integer(n/2^k);
Examples
intBitShiftRight(10) ; // 5.0 intBitShiftRight(32,3); // 4.0
Notes
Negative values for k will shift to the left.
Inputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | n | Integer value whose binary bits are to be shifted | |
| Integer | k | 1 | Integer places to be shifted (default = 1) |
Outputs
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | res | Integer value of the shifted bits |
Revisions
- Introduced in v2.1.0.