fxshift(fx, i)
fxshift_left(fx, i)
fxshift_right(fx, i)
fxshift_wrap(fx, i)
fxshift_left_wrap(fx, i)
fxshift_right_wrap(fx, i)
fxlshift_right_wrap(fx, i)

Return the fixnum fx arithmetically or logically shifted left or right by i positions.

For all functions except fxshift and fxshift_wrap, i must be a non-negative integer. If i is non-negative, it must be less than the value of fixnum_width(). If i is negative, fxshift will return the result of arithmetically shifting fx right by i bits. Otherwise, fxshift will return the result of shifting fx left by i bits.

Fxlshift_right_wrap logically right-shifts fx by i bits.


number_to_string(fxior(4294967296, fxshift(1, 2)), 2)
// 100000000000000000000000000000100

number_to_string(fxior(4294967296, fxshift(fxshift(1, 2), -3)), 2)
// 100000000000000000000000000000000

Also see:


Core Module Index | Contents