| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Acme::MITHALDU::XSGrabBag; |
|
2
|
1
|
|
|
1
|
|
18871
|
use strictures; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
4
|
|
|
3
|
1
|
|
|
1
|
|
146
|
use Exporter 'import'; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
24
|
|
|
4
|
1
|
|
|
1
|
|
299
|
use Acme::MITHALDU::XSGrabBag::Inline (); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
22
|
|
|
5
|
1
|
|
|
1
|
|
448
|
use Inline::C 0.74 (); |
|
|
1
|
|
|
|
|
28707
|
|
|
|
1
|
|
|
|
|
124
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.161310'; # VERSION |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: a bunch of XS math functions i'm not sure where to shove yet |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# This file is part of Acme-MITHALDU-XSGrabBag |
|
13
|
|
|
|
|
|
|
# |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
# Christian Walde has dedicated the work to the Commons by waiving all of his |
|
16
|
|
|
|
|
|
|
# or her rights to the work worldwide under copyright law and all related or |
|
17
|
|
|
|
|
|
|
# neighboring legal rights he or she had in the work, to the extent allowable by |
|
18
|
|
|
|
|
|
|
# law. |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# Works under CC0 do not require attribution. When citing the work, you should |
|
21
|
|
|
|
|
|
|
# not imply endorsement by the author. |
|
22
|
|
|
|
|
|
|
# |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
|
25
|
|
|
|
|
|
|
mix |
|
26
|
|
|
|
|
|
|
deg2rad |
|
27
|
|
|
|
|
|
|
rad2deg |
|
28
|
|
|
|
|
|
|
dot2_product |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
Acme::MITHALDU::XSGrabBag::Inline->import( |
|
32
|
|
|
|
|
|
|
C => join "\n", |
|
33
|
|
|
|
|
|
|
_mix(), |
|
34
|
|
|
|
|
|
|
_deg2rad(), |
|
35
|
|
|
|
|
|
|
_rad2deg(), |
|
36
|
|
|
|
|
|
|
_dot2_product(), |
|
37
|
|
|
|
|
|
|
); |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _mix { |
|
41
|
1
|
|
|
1
|
|
1
|
<<'...'; |
|
42
|
|
|
|
|
|
|
int mix(int a, int b, int c) { |
|
43
|
|
|
|
|
|
|
a -= b; a -= c; a ^= (c>>13); |
|
44
|
|
|
|
|
|
|
b -= c; b -= a; b ^= (a<<8); |
|
45
|
|
|
|
|
|
|
c -= a; c -= b; c ^= (b>>13); |
|
46
|
|
|
|
|
|
|
a -= b; a -= c; a ^= (c>>12); |
|
47
|
|
|
|
|
|
|
b -= c; b -= a; b ^= (a<<16); |
|
48
|
|
|
|
|
|
|
c -= a; c -= b; c ^= (b>>5); |
|
49
|
|
|
|
|
|
|
a -= b; a -= c; a ^= (c>>3); |
|
50
|
|
|
|
|
|
|
b -= c; b -= a; b ^= (a<<10); |
|
51
|
|
|
|
|
|
|
c -= a; c -= b; c ^= (b>>15); |
|
52
|
|
|
|
|
|
|
return c; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
... |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub _deg2rad { |
|
59
|
1
|
|
|
1
|
|
7
|
<<'...'; |
|
60
|
|
|
|
|
|
|
float deg2rad(float degrees) { |
|
61
|
|
|
|
|
|
|
return 0.0174532925 * degrees; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
... |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _rad2deg { |
|
68
|
1
|
|
|
1
|
|
2
|
<<'...'; |
|
69
|
|
|
|
|
|
|
float rad2deg(float radians) { |
|
70
|
|
|
|
|
|
|
return 57.2957795786 * radians; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
... |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _dot2_product { |
|
77
|
1
|
|
|
1
|
|
10
|
<<'...'; |
|
78
|
|
|
|
|
|
|
int dot2_product( int xa, int ya, int xb, int yb ) { |
|
79
|
|
|
|
|
|
|
int sum = 0; |
|
80
|
|
|
|
|
|
|
sum += xa * xb; |
|
81
|
|
|
|
|
|
|
sum += ya * yb; |
|
82
|
|
|
|
|
|
|
return sum; |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
... |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |