📄 intmap.pm
字号:
package KinoSearch::Util::IntMap;use strict;use warnings;use KinoSearch::Util::ToolSet;use base qw( KinoSearch::Util::Class );sub new { my ( $class, $map ) = @_; $class = ref($class) || $class; return bless $map, $class;}1;__END____XS__MODULE = KinoSearch PACKAGE = KinoSearch::Util::IntMap=for commentReturn either the remapped number, or undef if orig has been removed.=cutSV* get(int_map_ref, orig); SV *int_map_ref; I32 orig;PREINIT: I32 result;CODE: result = Kino_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 Kino_IntMap_get(SV*, I32);#endif /* include guard */__C__#include "KinoSearchUtilIntMap.h"I32Kino_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 NAMEKinoSearch::Util::IntMap - compact array of integers=head1 DESCRIPTIONAn IntMap is a C array of I32, stored in a scalar. The get() method returnseither the number present at the index requested, or undef if either the indexis out of range or the number at the index is -1.=head1 COPYRIGHTCopyright 2005-2007 Marvin Humphrey=head1 LICENSE, DISCLAIMER, BUGS, etc.See L<KinoSearch|KinoSearch> version 0.163.=end devdocs=cut
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -