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