File Coverage

prvhash64.xs
Criterion Covered Total %
statement 14 14 100.0
branch 4 6 66.6
condition n/a
subroutine n/a
pod n/a
total 18 20 90.0


line stmt bran cond sub pod time code
1             #include "EXTERN.h"
2             #include "perl.h"
3             #include "XSUB.h"
4             #include
5             #include
6            
7             /* Adjust include path via Makefile.PL INC or place headers next to this XS */
8             #include "prvhash64.h"
9            
10             MODULE = Digest::prvhash64 PACKAGE = Digest::prvhash64
11            
12             SV* prvhash64(msg_sv, hash_len, seed=0)
13             SV* msg_sv
14             size_t hash_len
15             UV seed
16             CODE:
17             {
18 20           STRLEN msg_len = 0;
19 20           const void* msg = (const void*)SvPVbyte(msg_sv, msg_len);
20 20 50         if (hash_len == 0 || (hash_len % sizeof(uint64_t)) != 0) {
    100          
21 1           croak("hash_len must be a positive multiple of 8");
22             }
23 19           SV* out = newSV(hash_len);
24 19           SvPOK_only(out);
25 19           SvCUR_set(out, hash_len);
26 19           char* buf = SvPVX(out);
27 19           prvhash64(msg, (size_t)msg_len, (void*)buf, (size_t)hash_len, (uint64_t)seed);
28 19           RETVAL = out;
29             }
30             OUTPUT:
31             RETVAL
32            
33             UV prvhash64_64m(msg_sv, seed=0)
34             SV* msg_sv
35             UV seed
36             CODE:
37             {
38 16           STRLEN msg_len = 0;
39 16           const void* msg = (const void*)SvPVbyte(msg_sv, msg_len);
40 16           uint64_t hv = prvhash64_64m(msg, (size_t)msg_len, (uint64_t)seed);
41 16 50         RETVAL = (UV)hv;
42             }
43             OUTPUT:
44             RETVAL