$left = 0;
$bits = -$bits;
}
- $bits = $length if $bits > $length;
- $length -= $bits;
- if ($left) {
- vcopy($_[0], $start, $_[0], $start + $bits, $length);
- vfill($_[0], $start, $bits, $insert) if defined $insert;
+ if ($bits < $length) {
+ $length -= $bits;
+ if ($left) {
+ vcopy($_[0], $start, $_[0], $start + $bits, $length);
+ vfill($_[0], $start, $bits, $insert) if defined $insert;
+ } else {
+ vcopy($_[0], $start + $bits, $_[0], $start, $length);
+ vfill($_[0], $start + $length, $bits, $insert) if defined $insert;
+ }
} else {
- vcopy($_[0], $start + $bits, $_[0], $start, $length);
- vfill($_[0], $start + $length, $bits, $insert) if defined $insert;
+ vfill($_[0], $start, $length, $insert) if defined $insert;
}
}