shiftL -package:clash-prelude
Shift the argument left by the specified number of bits (which must be
non-negative). Some instances may throw an
Overflow exception
if given a negative input.
An instance can define either this and
shiftR or the unified
shift, depending on which is more convenient for the type in
question.
Move all elements towards smaller indexes. Elements that fall off the
front are ignored. Empty slots are filled in with the given element.
O(n).
Shift the argument left by the specified number of bits (which must be
non-negative).
An instance can define either this and
shiftR or the unified
shift, depending on which is more convenient for the type in
question.
Shift the argument left by the specified number of bits (which must be
non-negative).
Shift-left operation
Even though the shift-amount is expressed as
Int#, the result
is undefined for negative shift-amounts.
A definition of shiftLeft that can deal with variable length shifts.
(Note that the
`shiftL` method from the
Bits class
requires an
Int shift amount.) Unfortunately, this'll generate
rather clumsy C code due to the use of tables etc., so we uninterpret
it for code generation purposes using the
cgUninterpret
function.
Shifting the N-bytes area just before the current pointer (the 3rd
argument). If the second argument is positive, shift it to right. If
it is negative, shift it to left.
offset moves as if it is
sticky to the area.
>>> withWriteBuffer 16 $ \wbuf -> copyByteString wbuf "ABCD" >> shiftLastN wbuf 1 3
"ABBCD"
>>> withWriteBuffer 16 $ \wbuf -> copyByteString wbuf "ABCD" >> shiftLastN wbuf 2 3
"ABCBCD"
>>> withWriteBuffer 16 $ \wbuf -> copyByteString wbuf "ABCDE" >> shiftLastN wbuf (-2) 3 >> ff wbuf 2
"CDEDE"
shiftLayer is the same as
shiftModifyLayer, but the
focus remains on the current workspace.
, occasionally <math>. Move the first element to the
end.
λ toList . shiftLeft $ fromList [1,2,3]
[2,3,1]
, occasionally <math>. Move the first element to the
end.
, occasionally <math>. Move the first element to the
end.