List-BinarySearch-XS
view release on metacpan or search on metacpan
0.05 2013-10-27
- Added git repository to META information.
- Removed unnecessary max==min test in binsearch (save a cycle or two).
0.04 2013-09-17
- Improvements to auto-generated META.* files.
0.03 2013-09-06
- Micro-optimization in XS code for binsearch (Consolidated output code
into PPCODE section.
- Remove "DEV RELEASE" mention in POD.
0.02 2013-09-05
- PUBLIC RELEASE
- Enough smoke tests have trickled in that I'm comfortable with portability
from Perl 5.8.9 through present. Would like to see more Windows tests, but
unofficial reports are that we build and test alright there as well.
- Bump version number to 0.02 and release.
- This version is compatible as a plugin for List::BinarySearch v0.12.
MODULE = List::BinarySearch::XS PACKAGE = List::BinarySearch::XS
PROTOTYPES: ENABLE
SV *
binsearch (block, needle, aref_haystack)
SV * block
SV * needle
SV * aref_haystack
PROTOTYPE: &$\@
PPCODE:
/* We need binsearch to return undef or empty list on no match, depending
* on context. This snippet detects an undef rv, and just massages it
* into an empty list.
*/
I32 rv = binsearch( block, needle, aref_haystack );
if( rv == -1 ) {
XSRETURN_EMPTY;
}
else {
SV* output = sv_2mortal(newSViv(rv));
( run in 0.983 second using v1.01-cache-2.11-cpan-5511b514fd6 )