blib/lib/Math/Int128.pm

filter: Statementstmt 100% 32 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 100% 41 / 41 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« strtoint128.h ↑ Summary c_api.h »
1 package Math::Int128;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # The "our $VERSION" bit needs to be at the beginning of the line for the
7 # benefit of the RewriteVersion plugin.
8 4 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 our $VERSION = '0.22';
10 4 require XSLoader;
11 4 XSLoader::load('Math::Int128', $VERSION);
12 }
13  
14 4 ▶use Math::Int64 0.51;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 4 ▶use constant MAX_INT128 => string_to_int128 ( '0x7fff_ffff_ffff_ffff_ffff_ffff_ffff_ffff');
Subroutine BEGIN: called CC=1 SCAR=0.0
17 4 ▶use constant MIN_INT128 => string_to_int128 ('-0x8000_0000_0000_0000_0000_0000_0000_0000');
Subroutine BEGIN: called CC=1 SCAR=0.0
18 4 ▶use constant MAX_UINT128 => string_to_uint128( '0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff');
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 4 require Exporter;
21  
22 4 our @ISA = qw(Exporter);
23  
24 4 our %EXPORT_TAGS = ( ctors => [qw( int128 uint128
25 string_to_int128
26 string_to_uint128 )],
27 pack => [qw( int128_to_number
28 int128_to_hex
29 net_to_int128
30 int128_to_net
31 native_to_int128
32 int128_to_native
33 uint128_to_number
34 uint128_to_hex
35 net_to_uint128
36 uint128_to_net
37 native_to_uint128
38 uint128_to_native )],
39 op => [qw( int128_set
40 int128_inc
41 int128_dec
42 int128_add
43 int128_sub
44 int128_mul
45 int128_pow
46 int128_div
47 int128_mod
48 int128_divmod
49 int128_neg
50 int128_not
51 int128_and
52 int128_or
53 int128_xor
54 int128_left
55 int128_right
56 int128_average
57 uint128_set
58 uint128_inc
59 uint128_dec
60 uint128_add
61 uint128_sub
62 uint128_mul
63 uint128_pow
64 uint128_div
65 uint128_mod
66 uint128_divmod
67 uint128_not
68 uint128_and
69 uint128_or
70 uint128_xor
71 uint128_left
72 uint128_right
73 uint128_average)],
74 limits => [qw( MAX_INT128
75 MIN_INT128
76 MAX_UINT128 )] );
77  
78 4 our @EXPORT_OK = map @$_, values %EXPORT_TAGS;
79  
80  
81 4 ▶use overload ( '+' => \&_add,
Subroutine BEGIN: called CC=1 SCAR=0.0
82 '+=' => \&_add,
83 '-' => \&_sub,
84 '-=' => \&_sub,
85 '*' => \&_mul,
86 '*=' => \&_mul,
87 '**' => \&_pow,
88 '**=' => \&_pow,
89 '/' => \&_div,
90 '/=' => \&_div,
91 '%' => \&_remainder,
92 '%=' => \&_remainder,
93 'neg' => \&_neg,
94 '++' => \&_inc,
95 '--' => \&_dec,
96 '!' => \&_not,
97 '~' => \&_bnot,
98 '&' => \&_and,
99 '|' => \&_or,
100 '^' => \&_xor,
101 '<<' => \&_left,
102 '>>' => \&_right,
103 '<=>' => \&_spaceship,
104 '>' => \&_gtn,
105 '<' => \&_ltn,
106 '>=' => \&_gen,
107 '<=' => \&_len,
108 '==' => \&_eqn,
109 '!=' => \&_nen,
110 'bool' => \&_bool,
111 '0+' => \&_number,
112 '""' => \&_string,
113 '=' => \&_clone,
114 4 fallback => 1 );
115  
116 package Math::UInt128;
117 4 ▶use overload ( '+' => \&_add,
Subroutine BEGIN: called CC=1 SCAR=0.0
118 '+=' => \&_add,
119 '-' => \&_sub,
120 '-=' => \&_sub,
121 '*' => \&_mul,
122 '*=' => \&_mul,
123 '**' => \&_pow,
124 '**=' => \&_pow,
125 '/' => \&_div,
126 '/=' => \&_div,
127 '%' => \&_remainder,
128 '%=' => \&_remainder,
129 'neg' => \&_neg,
130 '++' => \&_inc,
131 '--' => \&_dec,
132 '!' => \&_not,
133 '~' => \&_bnot,
134 '&' => \&_and,
135 '|' => \&_or,
136 '^' => \&_xor,
137 '<<' => \&_left,
138 '>>' => \&_right,
139 '<=>' => \&_spaceship,
140 '>' => \&_gtn,
141 '<' => \&_ltn,
142 '>=' => \&_gen,
143 '<=' => \&_len,
144 '==' => \&_eqn,
145 '!=' => \&_nen,
146 'bool' => \&_bool,
147 '0+' => \&_number,
148 '""' => \&_string,
149 '=' => \&_clone,
150 4 fallback => 1 );
151  
152 4 1;
153  
154 __END__
« strtoint128.h ↑ Summary c_api.h »