Math-Int128
view release on metacpan or search on metacpan
benchmarks/mod128.pl view on Meta::CPAN
sub FNV_1a_128_gmpz4 {
my $s = shift;
my $h = Math::GMPz->new( '144066263297769815596495629667062367629' );
my $p = Math::GMPz->new( '309485009821345068724781371' );
$h ^= $_, $h *= $p for unpack 'C*', $s;
return $h;
}
our $text = do{ local( @ARGV, $/ ) = $0; <> };
print length $text;
cmpthese -1, {
int128 => q[
my $fnv1 = uint128_to_hex( FNV_1_128( $text ) );
my $fnv1a = uint128_to_hex( FNV_1a_128( $text ) );
],
int128_pa => q[
my $fnv1 = uint128_to_hex( FNV_1_128_pa( $text ) );
my $fnv1a = uint128_to_hex( FNV_1a_128_pa( $text ) );
if ($opt{hints} && exists $hints{$func} && !$given_hints{$func}++) {
my $hint = $hints{$func};
$hint =~ s/^/ /mg;
print " --- hint for $func ---\n", $hint;
}
$rv;
}
sub usage
{
my($usage) = do { local(@ARGV,$/)=($0); <> } =~ /^=head\d$HS+SYNOPSIS\s*^(.*?)\s*^=/ms;
my %M = ( 'I' => '*' );
$usage =~ s/^\s*perl\s+\S+/$^X $0/;
$usage =~ s/([A-Z])<([^>]+)>/$M{$1}$2$M{$1}/g;
print <<ENDUSAGE;
Usage: $usage
See perldoc $0 for details.
ENDUSAGE
exit 2;
}
sub strip
{
my $self = do { local(@ARGV,$/)=($0); <> };
my($copy) = $self =~ /^=head\d\s+COPYRIGHT\s*^(.*?)^=\w+/ms;
$copy =~ s/^(?=\S+)/ /gms;
$self =~ s/^$HS+Do NOT edit.*?(?=^-)/$copy/ms;
$self =~ s/^SKIP.*(?=^__DATA__)/SKIP
if (\@ARGV && \$ARGV[0] eq '--unstrip') {
eval { require Devel::PPPort };
\$@ and die "Cannot require Devel::PPPort, please install.\\n";
if (eval \$Devel::PPPort::VERSION < $VERSION) {
die "$0 was originally generated with Devel::PPPort $VERSION.\\n"
. "Your Devel::PPPort is only version \$Devel::PPPort::VERSION.\\n"
( run in 0.656 second using v1.01-cache-2.11-cpan-49f99fa48dc )