File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/XS/Framework.x/i/xs/typemap/numeric.h
Criterion Covered Total %
statement 1 1 100.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 1 1 100.0


line stmt bran cond sub pod time code
1             #pragma once
2             #include "base.h"
3             #include "../Simple.h" // for _getnum()
4              
5             namespace xs {
6              
7             template <class TYPE> struct TypemapNumeric : TypemapBase<TYPE> {
8 3454           static inline TYPE in (SV* arg) { return detail::_getnum<TYPE>(arg); }
9             static inline Sv out (TYPE var, const Sv& = Sv()) { return Simple(var); }
10             };
11              
12             template <> struct Typemap<char> : TypemapNumeric<char> {};
13             template <> struct Typemap<short> : TypemapNumeric<short> {};
14             template <> struct Typemap<int> : TypemapNumeric<int> {};
15             template <> struct Typemap<long> : TypemapNumeric<long> {};
16             template <> struct Typemap<long long> : TypemapNumeric<long long> {};
17             template <> struct Typemap<unsigned char> : TypemapNumeric<unsigned char> {};
18             template <> struct Typemap<unsigned short> : TypemapNumeric<unsigned short> {};
19             template <> struct Typemap<unsigned> : TypemapNumeric<unsigned> {};
20             template <> struct Typemap<unsigned long> : TypemapNumeric<unsigned long> {};
21             template <> struct Typemap<unsigned long long> : TypemapNumeric<unsigned long long> {};
22             template <> struct Typemap<float> : TypemapNumeric<float> {};
23             template <> struct Typemap<double> : TypemapNumeric<double> {};
24              
25             template <> struct Typemap<bool> : TypemapBase<bool> {
26             static inline Sv out (bool var, const Sv& = {}) { return Simple(var); }
27             static inline bool in (Sv arg) { return arg.is_true(); }
28             };
29              
30             }