Navigation

Operators and Keywords

Function List:

C++ API

: bitshift (a, k)
: bitshift (a, k, n)

Return a k bit shift of n-digit unsigned integers in a.

A positive k leads to a left shift; A negative value to a right shift.

If n is omitted it defaults to 64. n must be in the range [1,64].

bitshift (eye (3), 1)
⇒
2 0 0
0 2 0
0 0 2

bitshift (10, [-2, -1, 0, 1, 2])
⇒ 2   5  10  20  40

See also: bitand, bitor, bitxor, bitset, bitget, bitcmp, intmax, flintmax.

Package: octave