blib/lib/Acme/MITHALDU/XSGrabBag.pm untested

filter: Statementstmt 0.0% 0 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 4 totaltotal 0.0% 0 / 32 SCAR 6.9
CC
1
Cov
0%
_mix
2.0
_deg2rad
2.0
_rad2deg
2.0
CRAP 2.0
1 package Acme::MITHALDU::XSGrabBag;
2 use strictures;
3 use Exporter 'import';
4 use Acme::MITHALDU::XSGrabBag::Inline ();
5 use Inline::C ();
6  
7 our $VERSION = '1.161290'; # 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 <<'...';
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 <<'...';
60 float deg2rad(float degrees) {
61 return 0.0174532925 * degrees;
62 }
63 ...
64 }
65  
66  
67 sub _rad2deg {
68 <<'...';
69 float rad2deg(float radians) {
70 return 57.2957795786 * radians;
71 }
72 ...
73 }
74  
75  
76 sub _dot2_product {
77 <<'...';
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__