rol!(::BitArray,::BitArray,::Integer)

rol!(dest::BitArray{1}, src::BitArray{1}, i::Integer) -> BitArray{1}

Performs a left rotation operation on src and put the result into dest.

Examples

julia> B = BitArray([1, 0, 1, 0, 1]);
julia> rol!(B, 2)
5-element BitArray{1}:
 0
 1
 0
 1
 0

This example performs a left rotation operation on the BitArray B by 2 positions. The elements are shifted to the left, and the last 2 elements wrap around to the beginning.

Common mistake example:

julia> B = BitArray([1, 0, 1, 0, 1]);
julia> rol!(B, -1)
ERROR: DomainError: rotation amount must be non-negative

In this example, a negative value is provided as the rotation amount. The rotation amount must be non-negative. Ensure that the rotation amount is a valid non-negative integer when using rol!.

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.

*Required Field
Details

Checking you are not a robot: