/usr/lib/perl5/KinoSearch1/Util/IntMap.pm is in libkinosearch1-perl 1.00-1build3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | package KinoSearch1::Util::IntMap;
use strict;
use warnings;
use KinoSearch1::Util::ToolSet;
use base qw( KinoSearch1::Util::Class );
sub new {
my ( $class, $map ) = @_;
$class = ref($class) || $class;
return bless $map, $class;
}
1;
__END__
__XS__
MODULE = KinoSearch1 PACKAGE = KinoSearch1::Util::IntMap
=for comment
Return either the remapped number, or undef if orig has been removed.
=cut
SV*
get(int_map_ref, orig);
SV *int_map_ref;
I32 orig;
PREINIT:
I32 result;
CODE:
result = Kino1_IntMap_get(int_map_ref, orig);
RETVAL = result == -1
? &PL_sv_undef
: newSViv(result);
OUTPUT: RETVAL
__H__
#ifndef H_KINOSEARCH_INT_MAP
#define H_KINOSEARCH_INT_MAP 1
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
I32 Kino1_IntMap_get(SV*, I32);
#endif /* include guard */
__C__
#include "KinoSearch1UtilIntMap.h"
I32
Kino1_IntMap_get(SV* int_map_ref, I32 orig) {
SV *int_map_sv;
I32 *map;
STRLEN len;
int_map_sv = SvRV(int_map_ref);
map = (I32*)SvPV(int_map_sv, len);
if (orig * sizeof(I32) > len) {
return -1;
}
return map[orig];
}
__POD__
=begin devdocs
=head1 NAME
KinoSearch1::Util::IntMap - compact array of integers
=head1 DESCRIPTION
An IntMap is a C array of I32, stored in a scalar. The get() method returns
either the number present at the index requested, or undef if either the index
is out of range or the number at the index is -1.
=head1 COPYRIGHT
Copyright 2005-2010 Marvin Humphrey
=head1 LICENSE, DISCLAIMER, BUGS, etc.
See L<KinoSearch1> version 1.00.
=end devdocs
=cut
|