Acme-Bitfield

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


my $bf = Acme::Bitfield->new( size => 100 );

# Mark item 42 as present
$bf->set( 42 );

# Check if we have item 42
say 'Found it!' if $bf->get(42);

# Statistics
printf "Progress: %.2f%%\r", ($bf->count / $bf->size * 100);

# Export raw binary for network transfer
my $raw = $bf->data;
```

# DESCRIPTION

`Acme::Bitfield` provides a compact way to track a large set of big endian boolean flags. It is specifically designed
to follow the BitTorrent (BEP 03) bit-ordering convention, where the most significant bit of the first byte represents
index 0.

lib/Acme/Bitfield.pod  view on Meta::CPAN


    my $bf = Acme::Bitfield->new( size => 100 );

    # Mark item 42 as present
    $bf->set( 42 );

    # Check if we have item 42
    say 'Found it!' if $bf->get(42);

    # Statistics
    printf "Progress: %.2f%%\r", ($bf->count / $bf->size * 100);

    # Export raw binary for network transfer
    my $raw = $bf->data;

=head1 DESCRIPTION

C<Acme::Bitfield> provides a compact way to track a large set of big endian boolean flags. It is specifically designed
to follow the BitTorrent (BEP 03) bit-ordering convention, where the most significant bit of the first byte represents
index 0.



( run in 0.805 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )