X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FScalar-Vec-Util.git;a=blobdiff_plain;f=lib%2FScalar%2FVec%2FUtil.pm;h=db6adba1de6489b764f298bc60f314ce393935a5;hp=4f69d8fd1d930c524362dbb8c2c51ad613be4632;hb=2506fbb7b9572d1dfbd5e776b236977c23d648dc;hpb=831b8bd03ca3ae94e3ba9e1e1b7d9be913dc9d13 diff --git a/lib/Scalar/Vec/Util.pm b/lib/Scalar/Vec/Util.pm index 4f69d8f..db6adba 100644 --- a/lib/Scalar/Vec/Util.pm +++ b/lib/Scalar/Vec/Util.pm @@ -11,23 +11,23 @@ Scalar::Vec::Util - Utility routines for vec strings. =head1 VERSION -Version 0.04 +Version 0.05 =cut our $VERSION; BEGIN { - $VERSION = '0.04'; + $VERSION = '0.05'; eval { require XSLoader; XSLoader::load(__PACKAGE__, $VERSION); 1; } or do { - sub SVU_PP () { 1 } - sub SVU_SIZE () { 1 } - *vfill = *vfill_pp; - *vcopy = *vcopy_pp; - *veq = *veq_pp; + *SVU_PP = sub () { 1 }; + *SVU_SIZE = sub () { 1 }; + *vfill = *vfill_pp; + *vcopy = *vcopy_pp; + *veq = *veq_pp; } } @@ -45,9 +45,11 @@ BEGIN { =head1 DESCRIPTION -A set of utilities to manipulate bits in vec strings. Highly optimized XS routines are used when available, but straightforward pure perl replacements are also provided for platforms without a C compiler. +A set of utilities to manipulate bits in vec strings. +Highly optimized XS routines are used when available, but straightforward pure perl replacements are also provided for platforms without a C compiler. -This module doesn't reimplement bit vectors. It can be used on the very same scalars that C builds, or actually on any Perl string (C). +This module doesn't reimplement bit vectors. +It can be used on the very same scalars that C builds, or actually on any Perl string (C). =head1 CONSTANTS @@ -57,13 +59,16 @@ True when pure perl fallbacks are used instead of XS functions. =head2 C -Size in bits of the unit used for moves. The higher this value is, the faster the XS functions are. It's usually C, except on non-little-endian architectures where it currently falls back to C (e.g. SPARC). +Size in bits of the unit used for moves. +The higher this value is, the faster the XS functions are. +It's usually C, except on non-little-endian architectures where it currently falls back to C (e.g. SPARC). =head1 FUNCTIONS =head2 C -Starting at C<$start> in C<$vec>, fills C<$length> bits with C<$bit>. Grows C<$vec> if necessary. +Starting at C<$start> in C<$vec>, fills C<$length> bits with C<$bit>. +Grows C<$vec> if necessary. =cut @@ -82,7 +87,10 @@ sub vfill_pp { =head2 C<< vcopy $from => $from_start, $to => $to_start, $length >> -Copies C<$length> bits starting at C<$from_start> in C<$from> to C<$to_start> in C<$to>. If C<$from_start + $length> is too long for C<$from>, zeros are copied past C<$length>. Grows C<$to> if necessary. +Copies C<$length> bits starting at C<$from_start> in C<$from> to C<$to_start> in C<$to>. +If C<$from_start + $length> is too long for C<$from>, zeros are copied past C<$length>. +Grows C<$to> if necessary. +Doesn't need to allocate any extra memory. =cut @@ -100,7 +108,8 @@ sub vcopy_pp { =head2 C<< veq $v1 => $v1_start, $v2 => $v2_start, $length >> -Returns true if the C<$length> bits starting at C<$v1_start> in C<$v1> and C<$v2_start> in C<$v2> are equal, and false otherwise. If needed, C<$length> is decreased to fit inside C<$v1> and C<$v2> boundaries. +Returns true if the C<$length> bits starting at C<$v1_start> in C<$v1> and C<$v2_start> in C<$v2> are equal, and false otherwise. +If needed, C<$length> is decreased to fit inside C<$v1> and C<$v2> boundaries. =cut @@ -117,9 +126,11 @@ sub veq_pp { =head1 EXPORT -The functions L, L and L are only exported on request. All of them are exported by the tags C<':funcs'> and C<':all'>. +The functions L, L and L are only exported on request. +All of them are exported by the tags C<':funcs'> and C<':all'>. -The constants L and L are also only exported on request. They are all exported by the tags C<':consts'> and C<':all'>. +The constants L and L are also only exported on request. +They are all exported by the tags C<':consts'> and C<':all'>. =cut @@ -135,7 +146,8 @@ $EXPORT_TAGS{'all'} = [ @EXPORT_OK ]; =head1 BENCHMARKS -The following timings were obtained by running the C script. The C<_pp> entries are the pure Perl versions, while C<_bv> are L versions. +The following timings were obtained by running the C script. +The C<_pp> entries are the pure Perl versions, whereas C<_bv> are L versions. =over 4 @@ -213,7 +225,8 @@ The following timings were obtained by running the C script. T =head1 CAVEATS -Please report architectures where we can't use the alignment as the move unit. I'll add exceptions for them. +Please report architectures where we can't use the alignment as the move unit. +I'll add exceptions for them. =head1 DEPENDENCIES @@ -227,11 +240,12 @@ L gives a complete reimplementation of bit vectors. Vincent Pit, C<< >>, L. -You can contact me by mail or on #perl @ FreeNode (vincent or Prof_Vince). +You can contact me by mail or on C (vincent). =head1 BUGS -Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. +Please report any bugs or feature requests to C, or through the web interface at L. +I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT