Acme-Bitfield

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

{
   "X_No_Archive" : "Yes",
   "abstract" : "Bitmask for Tracking Boolean Sets",
   "author" : [
      "Sanko Robinson <sanko@cpan.org>"
   ],
   "description" : "Provides a compact way to track a large set of boolean flags.",
   "dynamic_config" : 0,
   "generated_by" : "App::mii v1.0.0",
   "keywords" : [
      "bitfield",
      "bittorrent",
      "interplanetary"
   ],
   "license" : [
      "artistic_2"
   ],

README.md  view on Meta::CPAN


# 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.

## Bit Ordering

\* Byte 0, Bit 0 (0x80) -> Index 0 \* Byte 0, Bit 7 (0x01) -> Index 7 \* Byte 1, Bit 0 (0x80) -> Index 8

This is the inverse of Perl's internal `vec` bit-ordering, and this module handles the necessary bit-swizzling
transparently.

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

    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.

=head2 Bit Ordering

* Byte 0, Bit 0 (0x80) -> Index 0 * Byte 0, Bit 7 (0x01) -> Index 7 * Byte 1, Bit 0 (0x80) -> Index 8

This is the inverse of Perl's internal C<vec> bit-ordering, and this module handles the necessary bit-swizzling
transparently.



( run in 0.589 second using v1.01-cache-2.11-cpan-140bd7fdf52 )