6 use Benchmark qw/cmpthese/;
8 use lib qw{blib/arch blib/lib};
9 use Scalar::Vec::Util qw/vfill vcopy veq/;
10 my $has_bv = eval "use Bit::Vector; 1" || 0;
11 print 'We ' . ('don\'t ' x !$has_bv) . "have Bit::Vector.\n";
19 $_[0] = 0 if $_[0] >= $n;
24 return $n - ($_[0] > $_[1] ? $_[0] : $_[1])
27 my ($bv1, $bv2, $bv3, $bv4);
29 ($bv1, $bv2, $bv3, $bv4) = Bit::Vector->new($n, 4);
34 vfill => sub { vfill $x, inc($i), $n - $i, 1 },
35 vfill_pp => sub { Scalar::Vec::Util::vfill_pp($x, inc($i), $n - $i, 1) },
36 (vfill_bv => sub { $bv1->Interval_Fill(inc($i), $n - 1) }) x $has_bv
44 vcopy => sub { vcopy $x, inc($i), $y, inc($j), len($i, $j) },
45 vcopy_pp => sub { Scalar::Vec::Util::vcopy_pp($x, inc($i), $y, inc($j), len($i, $j)) },
46 (vcopy_bv => sub { $bv2->Interval_Copy($bv1, inc($j), inc($i), len($i, $j)) }) x $has_bv
53 vmove => sub { vcopy $x, inc($i), $x, inc($j), len($i, $j) },
54 vmove_pp => sub { Scalar::Vec::Util::vcopy_pp($x, inc($i), $x, inc($j), len($i, $j)) },
55 (vmove_bv => sub { $bv1->Interval_Copy($bv1, inc($j), inc($i), len($i, $j)) }) x $has_bv
68 veq => sub { veq $x, inc($i), $y, inc($j), len($i, $j) },
69 veq_pp => sub { Scalar::Vec::Util::veq_pp($x, inc($i), $y, inc($j), len($i, $j)) },
75 $bv3->Interval_Copy($bv1, 0, $i, $l);
77 $bv4->Interval_Copy($bv2, 0, $j, $l);