blib/lib/Text/Bidi/Array/Long.pm

filter: Statementstmt 82.2% 37 / 45 Branchbran 12.5% 1 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 15 / 18 Podpod 100% 1 / 1 totaltotal 75.0% 54 / 72 CC 5 SCAR 9.2
CC
5
Cov
72%
__ANON__
6.0
__ANON__
6.0
STORESIZE
6.0
CRAP 2.5
« blib/lib/Text/Bidi/private.pm ↑ Summary blib/lib/Text/Bidi/Array/Byte.pm »
1 # Created: Tue 27 Aug 2013 06:12:39 PM IDT
2 # Last Changed: Tue 28 Jun 2022 09:50:42 PM IDT
3  
4 2 ▶use 5.10.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 package Text::Bidi::Array::Long;
10 # ABSTRACT: Dual-life long arrays
11 2 $Text::Bidi::Array::Long::VERSION = '3.01';
12  
13 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶use Text::Bidi::Array;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶use base qw(Text::Bidi::Array);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18  
19 2 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.2
20 # fribidi uses native endianness, vec uses N (big-endian)
21  
22 2 ▶ use Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 2 ▶ if ( $Config{'byteorder'} % 10 == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Text::Bidi::Array::Long::Config{'byteorder'} % 10 == 1) { } 0 2 2
25 # big-endian
26 0 ▶ *big_to_native = sub { wantarray ? @_ : $_[0] };
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
27 0 ▶ *native_to_big = sub { wantarray ? @_ : $_[0] };
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
28 } else {
29 2 ▶ *big_to_native = sub { unpack('L*', pack('N*', @_)) };
Subroutine __ANON__: called CC=1 SCAR=0.0
30 2 ▶ *native_to_big = sub { unpack('N*', pack('L*', @_)) };
Subroutine __ANON__: called CC=1 SCAR=0.0
31 }
32 }
33  
34 1 ▶sub pack {
Subroutine pack: called CC=1 SCAR=0.0
Pod documented
35 1 shift;
36 1 pack('L*', @_)
37 }
38  
39 1 ▶sub STORE {
Subroutine STORE: called CC=1 SCAR=0.0
40 1 my ( $self, $i, $v ) = @_;
41 1 vec($self->{'data'}, $i, 32) = native_to_big($v)
42 }
43  
44 3 ▶sub FETCH {
Subroutine FETCH: called CC=1 SCAR=0.0
45 3 my ( $self, $i ) = @_;
46 3 big_to_native(vec($self->{'data'}, $i, 32))
47 }
48  
49 1 ▶sub FETCHSIZE {
Subroutine FETCHSIZE: called CC=1 SCAR=0.0
50 1 (length($_[0]->{'data'})+3)/4
51 }
52  
53 0 ▶sub STORESIZE {
Subroutine STORESIZE: not called CC=2 SCAR=17.9
54 0 my ($self, $s) = @_;
55 0 ▶ if ($self->FETCHSIZE >= $s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->FETCHSIZE >= $s) { } 0 0 0
56 0 substr($self->{'data'}, $s * 4) = '';
57 } else {
58 0 $self->STORE($s - 1, 0);
59 }
60 }
61  
62 2 1;
63  
64 __END__
« blib/lib/Text/Bidi/private.pm ↑ Summary blib/lib/Text/Bidi/Array/Byte.pm »