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

TypeNameDefaultDescription
IntegernInteger value whose binary bits are to be shifted
Integerk1Integer places to be shifted (default = 1)

Outputs

TypeNameDefaultDescription
IntegerresInteger value of the shifted bits

Revisions

  • Introduced in v2.1.0.