rol
rol(B::BitArray{1}, i::Integer) -> BitArray{1}
Performs a left rotation operation.
Examples
julia> rol([true, false, true, false, true], 2)
5-element BitArray{1}:
true
false
true
false
true
This example performs a left rotation operation on the given BitArray
B
by i
positions. The elements are shifted to the left, and the last i
elements wrap around to the beginning.
Common mistake example:
julia> rol([true, false, true, false, true], -1)
ERROR: ArgumentError: Invalid number of positions for rotation: -1
In this example, a negative value is provided for the number of positions to rotate. The number of positions should be a non-negative integer.
See Also
bitpack, bitunpack, bswap, flipbits!, htol, hton, isbits, ltoh, ntoh, rol, rol!, ror, ror!, signbit,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.