Data-Bitfield

 view release on metacpan or  search on metacpan

t/01boolfield.t  view on Meta::CPAN

      second => boolfield(1),
      third  => boolfield(2);

   is( sprintf( "%v02x", pack_BYTES( first => 1, third => 1 ) ), "05",
      'pack_BYTES' );

   is_deeply( { unpack_BYTES( "\x05" ) }, { first => 1, second => !1, third => 1 },
      'unpack_BYTES' );
}

# endpoints
{
   bitfield { format => "bytes-LE" }, U32L =>
      high => boolfield(31),
      low  => boolfield(0);

   is( pack_U32L( low => 1, high => 1 ), "\x01\x00\x00\x80",
      'pack_U32L' );

   is_deeply( { unpack_U32L( "\x01\x00\x00\x80" ) }, { low => 1, high => 1 },
      'unpack_U32L' );

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.037 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )