Coverage Report

Created: 2026-08-31 06:12

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/upx/src/util/xspan_fwd.h
Line
Count
Source
1
/* xspan -- a minimally invasive checked memory smart pointer
2
3
   This file is part of the UPX executable compressor.
4
5
   Copyright (C) Markus Franz Xaver Johannes Oberhumer
6
   All Rights Reserved.
7
8
   UPX and the UCL library are free software; you can redistribute them
9
   and/or modify them under the terms of the GNU General Public License as
10
   published by the Free Software Foundation; either version 2 of
11
   the License, or (at your option) any later version.
12
13
   This program is distributed in the hope that it will be useful,
14
   but WITHOUT ANY WARRANTY; without even the implied warranty of
15
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
   GNU General Public License for more details.
17
18
   You should have received a copy of the GNU General Public License
19
   along with this program; see the file COPYING.
20
   If not, write to the Free Software Foundation, Inc.,
21
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23
   Markus F.X.J. Oberhumer
24
   <markus@oberhumer.com>
25
 */
26
27
// manually forward a number of well-known functions using a checked "raw_bytes()" call
28
//
29
// uses C
30
// uses optional D, E and XSPAN_FWD_C_IS_MEMBUFFER
31
// needs XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION
32
//
33
// example for a default implementation:
34
//   #define XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION(A, B, RType)
35
//       std::enable_if_t<std::is_convertible_v<A *, B *> || std::is_convertible_v<B *, A *>, RType>
36
37
// requires convertible T* to U* or U* to T*
38
#define XSPAN_FWD_TU_CONVERTIBLE(RType)                                                            \
39
    template <class T, class U>                                                                    \
40
    inline XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION(T, U, RType)
41
// requires convertible to void* (i.e. any pointer type matches)
42
#define XSPAN_FWD_TU_VOIDPTR(RType)                                                                \
43
    template <class T, class U>                                                                    \
44
    inline RType
45
46
/*************************************************************************
47
// overloads of global operators
48
**************************************************************************/
49
50
#ifndef XSPAN_FWD_C_IS_MEMBUFFER
51
52
// global operator: disallow "n + C" => force using "C + n" (member function) instead
53
template <class T, class U>
54
inline typename std::enable_if<std::is_integral<U>::value, void *>::type operator+(U, const C<T> &)
55
    XSPAN_DELETED_FUNCTION;
56
57
#endif // XSPAN_FWD_C_IS_MEMBUFFER
58
59
/*************************************************************************
60
// overloads for standard functions
61
**************************************************************************/
62
63
template <class T>
64
inline void *memchr(const C<T> &a, int v, size_t n) {
65
    return memchr(a.raw_bytes(n), v, n);
66
}
67
template <class T>
68
0
inline const void *memchr(const C<const T> &a, int v, size_t n) {
69
0
    return memchr(a.raw_bytes(n), v, n);
70
0
}
71
72
template <class T>
73
85.5k
inline int memcmp(const C<T> &a, const void *b, size_t n) {
74
85.5k
    return memcmp(a.raw_bytes(n), b, n);
75
85.5k
}
76
template <class T>
77
42.7k
inline int memcmp(const void *a, const C<T> &b, size_t n) {
78
42.7k
    return memcmp(a, b.raw_bytes(n), n);
79
42.7k
}
int memcmp<unsigned char>(void const*, MemBufferBase<unsigned char> const&, unsigned long)
Line
Count
Source
77
42.7k
inline int memcmp(const void *a, const C<T> &b, size_t n) {
78
42.7k
    return memcmp(a, b.raw_bytes(n), n);
79
42.7k
}
Unexecuted instantiation: int memcmp<unsigned char const>(void const*, XSpan::Span<unsigned char const> const&, unsigned long)
80
85.5k
XSPAN_FWD_TU_VOIDPTR(int) memcmp(const C<T> &a, const C<U> &b, size_t n) {
81
85.5k
    return memcmp(a.raw_bytes(n), b.raw_bytes(n), n);
82
85.5k
}
83
#ifdef D
84
XSPAN_FWD_TU_VOIDPTR(int) memcmp(const C<T> &a, const D<U> &b, size_t n) {
85
    return memcmp(a.raw_bytes(n), b.raw_bytes(n), n);
86
}
87
#endif
88
#ifdef E
89
XSPAN_FWD_TU_VOIDPTR(int) memcmp(const C<T> &a, const E<U> &b, size_t n) {
90
    return memcmp(a.raw_bytes(n), b.raw_bytes(n), n);
91
}
92
#endif
93
94
template <class T>
95
3.96k
inline void *memcpy(const C<T> a, const void *b, size_t n) {
96
3.96k
    return memcpy(a.raw_bytes(n), b, n);
97
3.96k
}
void* memcpy<unsigned char>(MemBufferBase<unsigned char>, void const*, unsigned long)
Line
Count
Source
95
3.59k
inline void *memcpy(const C<T> a, const void *b, size_t n) {
96
3.59k
    return memcpy(a.raw_bytes(n), b, n);
97
3.59k
}
void* memcpy<unsigned char>(XSpan::Span<unsigned char>, void const*, unsigned long)
Line
Count
Source
95
367
inline void *memcpy(const C<T> a, const void *b, size_t n) {
96
367
    return memcpy(a.raw_bytes(n), b, n);
97
367
}
Unexecuted instantiation: void* memcpy<unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char>, void const*, unsigned long)
98
template <class T>
99
351
inline void *memcpy(void *a, const C<T> &b, size_t n) {
100
351
    return memcpy(a, b.raw_bytes(n), n);
101
351
}
void* memcpy<unsigned char>(void*, XSpan::Span<unsigned char> const&, unsigned long)
Line
Count
Source
99
306
inline void *memcpy(void *a, const C<T> &b, size_t n) {
100
306
    return memcpy(a, b.raw_bytes(n), n);
101
306
}
Unexecuted instantiation: void* memcpy<unsigned char>(void*, XSpan::PtrOrSpanOrNull<unsigned char> const&, unsigned long)
Unexecuted instantiation: void* memcpy<unsigned char>(void*, MemBufferBase<unsigned char> const&, unsigned long)
void* memcpy<unsigned char const>(void*, XSpan::Span<unsigned char const> const&, unsigned long)
Line
Count
Source
99
45
inline void *memcpy(void *a, const C<T> &b, size_t n) {
100
45
    return memcpy(a, b.raw_bytes(n), n);
101
45
}
Unexecuted instantiation: void* memcpy<PeFile::pe_section_t>(void*, XSpan::PtrOrSpanOrNull<PeFile::pe_section_t> const&, unsigned long)
102
398
XSPAN_FWD_TU_VOIDPTR(void *) memcpy(const C<T> &a, const C<U> &b, size_t n) {
103
398
    return memcpy(a.raw_bytes(n), b.raw_bytes(n), n);
104
398
}
105
#ifdef D
106
XSPAN_FWD_TU_VOIDPTR(void *) memcpy(const C<T> &a, const D<U> &b, size_t n) {
107
    return memcpy(a.raw_bytes(n), b.raw_bytes(n), n);
108
}
109
#endif
110
#ifdef E
111
0
XSPAN_FWD_TU_VOIDPTR(void *) memcpy(const C<T> &a, const E<U> &b, size_t n) {
112
0
    return memcpy(a.raw_bytes(n), b.raw_bytes(n), n);
113
0
}
114
#endif
115
116
template <class T>
117
0
inline void *memmove(const C<T> a, const void *b, size_t n) {
118
0
    return memmove(a.raw_bytes(n), b, n);
119
0
}
120
template <class T>
121
0
inline void *memmove(void *a, const C<T> &b, size_t n) {
122
0
    return memmove(a, b.raw_bytes(n), n);
123
0
}
124
13.4k
XSPAN_FWD_TU_VOIDPTR(void *) memmove(const C<T> &a, const C<U> &b, size_t n) {
125
13.4k
    return memmove(a.raw_bytes(n), b.raw_bytes(n), n);
126
13.4k
}
Unexecuted instantiation: void* memmove<unsigned char, unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char> const&, XSpan::PtrOrSpanOrNull<unsigned char> const&, unsigned long)
void* memmove<unsigned char, unsigned char const>(XSpan::Span<unsigned char> const&, XSpan::Span<unsigned char const> const&, unsigned long)
Line
Count
Source
124
13.4k
XSPAN_FWD_TU_VOIDPTR(void *) memmove(const C<T> &a, const C<U> &b, size_t n) {
125
13.4k
    return memmove(a.raw_bytes(n), b.raw_bytes(n), n);
126
13.4k
}
127
#ifdef D
128
XSPAN_FWD_TU_VOIDPTR(void *) memmove(const C<T> &a, const D<U> &b, size_t n) {
129
    return memmove(a.raw_bytes(n), b.raw_bytes(n), n);
130
}
131
#endif
132
#ifdef E
133
XSPAN_FWD_TU_VOIDPTR(void *) memmove(const C<T> &a, const E<U> &b, size_t n) {
134
    return memmove(a.raw_bytes(n), b.raw_bytes(n), n);
135
}
136
#endif
137
138
template <class T>
139
85.5k
inline void *memset(const C<T> &a, int v, size_t n) {
140
85.5k
    return memset(a.raw_bytes(n), v, n);
141
85.5k
}
Unexecuted instantiation: void* memset<unsigned char>(XSpan::Span<unsigned char> const&, int, unsigned long)
void* memset<unsigned char>(MemBufferBase<unsigned char> const&, int, unsigned long)
Line
Count
Source
139
85.5k
inline void *memset(const C<T> &a, int v, size_t n) {
140
85.5k
    return memset(a.raw_bytes(n), v, n);
141
85.5k
}
Unexecuted instantiation: void* memset<unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char> const&, int, unsigned long)
142
143
/*************************************************************************
144
// overloads for UPX extras 1
145
**************************************************************************/
146
147
template <class T>
148
0
inline int ptr_diff_bytes(const C<T> &a, const void *b) {
149
0
    return ptr_diff_bytes(a.raw_bytes(0), b);
150
0
}
151
template <class T>
152
0
inline int ptr_diff_bytes(const void *a, const C<T> &b) {
153
0
    return ptr_diff_bytes(a, b.raw_bytes(0));
154
0
}
155
124k
XSPAN_FWD_TU_VOIDPTR(int) ptr_diff_bytes(const C<T> &a, const C<U> &b) {
156
124k
    return ptr_diff_bytes(a.raw_bytes(0), b.raw_bytes(0));
157
124k
}
Unexecuted instantiation: int ptr_diff_bytes<unsigned char const, unsigned char const>(XSpan::Span<unsigned char const> const&, XSpan::Span<unsigned char const> const&)
int ptr_diff_bytes<LE16, unsigned char>(XSpan::PtrOrSpanOrNull<LE16> const&, XSpan::PtrOrSpanOrNull<unsigned char> const&)
Line
Count
Source
155
124k
XSPAN_FWD_TU_VOIDPTR(int) ptr_diff_bytes(const C<T> &a, const C<U> &b) {
156
124k
    return ptr_diff_bytes(a.raw_bytes(0), b.raw_bytes(0));
157
124k
}
158
#ifdef D
159
0
XSPAN_FWD_TU_VOIDPTR(int) ptr_diff_bytes(const C<T> &a, const D<U> &b) {
160
0
    return ptr_diff_bytes(a.raw_bytes(0), b.raw_bytes(0));
161
0
}
162
#endif
163
#ifdef E
164
XSPAN_FWD_TU_VOIDPTR(int) ptr_diff_bytes(const C<T> &a, const E<U> &b) {
165
    return ptr_diff_bytes(a.raw_bytes(0), b.raw_bytes(0));
166
}
167
#endif
168
169
template <class T>
170
11
inline unsigned ptr_udiff_bytes(const C<T> &a, const void *b) {
171
11
    return ptr_udiff_bytes(a.raw_bytes(0), b);
172
11
}
Unexecuted instantiation: unsigned int ptr_udiff_bytes<unsigned char const>(XSpan::Span<unsigned char const> const&, void const*)
Unexecuted instantiation: unsigned int ptr_udiff_bytes<unsigned char>(XSpan::Span<unsigned char> const&, void const*)
unsigned int ptr_udiff_bytes<LE32>(XSpan::Span<LE32> const&, void const*)
Line
Count
Source
170
11
inline unsigned ptr_udiff_bytes(const C<T> &a, const void *b) {
171
11
    return ptr_udiff_bytes(a.raw_bytes(0), b);
172
11
}
Unexecuted instantiation: unsigned int ptr_udiff_bytes<unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char> const&, void const*)
173
template <class T>
174
0
inline unsigned ptr_udiff_bytes(const void *a, const C<T> &b) {
175
0
    return ptr_udiff_bytes(a, b.raw_bytes(0));
176
0
}
Unexecuted instantiation: unsigned int ptr_udiff_bytes<unsigned char>(void const*, MemBufferBase<unsigned char> const&)
Unexecuted instantiation: unsigned int ptr_udiff_bytes<unsigned char>(void const*, XSpan::PtrOrSpanOrNull<unsigned char> const&)
177
256k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const C<U> &b) {
178
256k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
179
256k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpanOrNull<unsigned short> const&, XSpan::PtrOrSpanOrNull<char> const&)
Line
Count
Source
177
85.5k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const C<U> &b) {
178
85.5k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
179
85.5k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpan<unsigned short> const&, XSpan::PtrOrSpan<char> const&)
Line
Count
Source
177
85.5k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const C<U> &b) {
178
85.5k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
179
85.5k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::Span<unsigned short> const&, XSpan::Span<char> const&)
Line
Count
Source
177
85.5k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const C<U> &b) {
178
85.5k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
179
85.5k
}
Unexecuted instantiation: unsigned int ptr_udiff_bytes<unsigned char, unsigned char>(XSpan::Span<unsigned char> const&, XSpan::Span<unsigned char> const&)
Unexecuted instantiation: unsigned int ptr_udiff_bytes<unsigned char const, unsigned char const>(XSpan::Span<unsigned char const> const&, XSpan::Span<unsigned char const> const&)
Unexecuted instantiation: unsigned int ptr_udiff_bytes<unsigned char, unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char> const&, XSpan::PtrOrSpanOrNull<unsigned char> const&)
180
#ifdef D
181
256k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const D<U> &b) {
182
256k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
183
256k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpan<unsigned short> const&, XSpan::PtrOrSpanOrNull<char> const&)
Line
Count
Source
181
85.5k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const D<U> &b) {
182
85.5k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
183
85.5k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::Span<unsigned short> const&, XSpan::PtrOrSpanOrNull<char> const&)
Line
Count
Source
181
85.5k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const D<U> &b) {
182
85.5k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
183
85.5k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpanOrNull<unsigned short> const&, XSpan::PtrOrSpan<char> const&)
Line
Count
Source
181
85.5k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const D<U> &b) {
182
85.5k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
183
85.5k
}
Unexecuted instantiation: unsigned int ptr_udiff_bytes<unsigned char, unsigned char>(XSpan::Span<unsigned char> const&, XSpan::PtrOrSpanOrNull<unsigned char> const&)
184
#endif
185
#ifdef E
186
256k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const E<U> &b) {
187
256k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
188
256k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::Span<unsigned short> const&, XSpan::PtrOrSpan<char> const&)
Line
Count
Source
186
85.5k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const E<U> &b) {
187
85.5k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
188
85.5k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpanOrNull<unsigned short> const&, XSpan::Span<char> const&)
Line
Count
Source
186
85.5k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const E<U> &b) {
187
85.5k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
188
85.5k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpan<unsigned short> const&, XSpan::Span<char> const&)
Line
Count
Source
186
85.5k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const E<U> &b) {
187
85.5k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
188
85.5k
}
189
#endif
190
191
/*************************************************************************
192
// overloads for UPX extras 2
193
**************************************************************************/
194
195
#ifdef UPX_VERSION_HEX
196
197
template <class T>
198
0
inline unsigned upx_adler32(const C<T> &a, unsigned n, unsigned adler = 1) {
199
0
    return upx_adler32(a.raw_bytes(n), n, adler);
200
0
}
Unexecuted instantiation: unsigned int upx_adler32<unsigned char>(MemBufferBase<unsigned char> const&, unsigned int, unsigned int)
Unexecuted instantiation: unsigned int upx_adler32<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&, unsigned int, unsigned int)
Unexecuted instantiation: unsigned int upx_adler32<unsigned char>(XSpan::Span<unsigned char> const&, unsigned int, unsigned int)
Unexecuted instantiation: unsigned int upx_adler32<unsigned char const>(XSpan::Span<unsigned char const> const&, unsigned int, unsigned int)
201
202
template <class T>
203
684k
inline unsigned get_ne16(const C<T> &a) {
204
684k
    return get_ne16(a.raw_bytes(2));
205
684k
}
206
template <class T>
207
684k
inline unsigned get_ne24(const C<T> &a) {
208
684k
    return get_ne24(a.raw_bytes(3));
209
684k
}
210
template <class T>
211
808k
inline unsigned get_ne32(const C<T> &a) {
212
808k
    return get_ne32(a.raw_bytes(4));
213
808k
}
unsigned int get_ne32<unsigned char const>(XSpan::PtrOrSpan<unsigned char const> const&)
Line
Count
Source
211
124k
inline unsigned get_ne32(const C<T> &a) {
212
124k
    return get_ne32(a.raw_bytes(4));
213
124k
}
unsigned int get_ne32<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
211
684k
inline unsigned get_ne32(const C<T> &a) {
212
684k
    return get_ne32(a.raw_bytes(4));
213
684k
}
214
template <class T>
215
684k
inline upx_uint64_t get_ne64(const C<T> &a) {
216
684k
    return get_ne64(a.raw_bytes(8));
217
684k
}
218
219
template <class T>
220
684k
inline unsigned get_be16(const C<T> &a) {
221
684k
    return get_be16(a.raw_bytes(2));
222
684k
}
223
template <class T>
224
684k
inline unsigned get_be24(const C<T> &a) {
225
684k
    return get_be24(a.raw_bytes(3));
226
684k
}
227
template <class T>
228
699k
inline unsigned get_be32(const C<T> &a) {
229
699k
    return get_be32(a.raw_bytes(4));
230
699k
}
unsigned int get_be32<unsigned char const>(XSpan::Span<unsigned char const> const&)
Line
Count
Source
228
14.9k
inline unsigned get_be32(const C<T> &a) {
229
14.9k
    return get_be32(a.raw_bytes(4));
230
14.9k
}
unsigned int get_be32<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
228
684k
inline unsigned get_be32(const C<T> &a) {
229
684k
    return get_be32(a.raw_bytes(4));
230
684k
}
231
template <class T>
232
684k
inline upx_uint64_t get_be64(const C<T> &a) {
233
684k
    return get_be64(a.raw_bytes(8));
234
684k
}
235
236
template <class T>
237
690k
inline unsigned get_le16(const C<T> &a) {
238
690k
    return get_le16(a.raw_bytes(2));
239
690k
}
unsigned int get_le16<unsigned char>(XSpan::Span<unsigned char> const&)
Line
Count
Source
237
119
inline unsigned get_le16(const C<T> &a) {
238
119
    return get_le16(a.raw_bytes(2));
239
119
}
unsigned int get_le16<unsigned char const>(XSpan::Span<unsigned char const> const&)
Line
Count
Source
237
6.68k
inline unsigned get_le16(const C<T> &a) {
238
6.68k
    return get_le16(a.raw_bytes(2));
239
6.68k
}
Unexecuted instantiation: unsigned int get_le16<unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char> const&)
unsigned int get_le16<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
237
684k
inline unsigned get_le16(const C<T> &a) {
238
684k
    return get_le16(a.raw_bytes(2));
239
684k
}
240
template <class T>
241
685k
inline unsigned get_le24(const C<T> &a) {
242
685k
    return get_le24(a.raw_bytes(3));
243
685k
}
unsigned int get_le24<unsigned char const>(XSpan::Span<unsigned char const> const&)
Line
Count
Source
241
1.16k
inline unsigned get_le24(const C<T> &a) {
242
1.16k
    return get_le24(a.raw_bytes(3));
243
1.16k
}
unsigned int get_le24<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
241
684k
inline unsigned get_le24(const C<T> &a) {
242
684k
    return get_le24(a.raw_bytes(3));
243
684k
}
244
template <class T>
245
1.35M
inline unsigned get_le32(const C<T> &a) {
246
1.35M
    return get_le32(a.raw_bytes(4));
247
1.35M
}
unsigned int get_le32<unsigned char const>(XSpan::Span<unsigned char const> const&)
Line
Count
Source
245
205k
inline unsigned get_le32(const C<T> &a) {
246
205k
    return get_le32(a.raw_bytes(4));
247
205k
}
unsigned int get_le32<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
245
684k
inline unsigned get_le32(const C<T> &a) {
246
684k
    return get_le32(a.raw_bytes(4));
247
684k
}
unsigned int get_le32<unsigned char>(XSpan::Span<unsigned char> const&)
Line
Count
Source
245
359k
inline unsigned get_le32(const C<T> &a) {
246
359k
    return get_le32(a.raw_bytes(4));
247
359k
}
Unexecuted instantiation: unsigned int get_le32<unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char> const&)
unsigned int get_le32<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&)
Line
Count
Source
245
109k
inline unsigned get_le32(const C<T> &a) {
246
109k
    return get_le32(a.raw_bytes(4));
247
109k
}
248
template <class T>
249
714k
inline upx_uint64_t get_le64(const C<T> &a) {
250
714k
    return get_le64(a.raw_bytes(8));
251
714k
}
unsigned long long get_le64<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&)
Line
Count
Source
249
15.2k
inline upx_uint64_t get_le64(const C<T> &a) {
250
15.2k
    return get_le64(a.raw_bytes(8));
251
15.2k
}
unsigned long long get_le64<unsigned char>(XSpan::Span<unsigned char> const&)
Line
Count
Source
249
15.2k
inline upx_uint64_t get_le64(const C<T> &a) {
250
15.2k
    return get_le64(a.raw_bytes(8));
251
15.2k
}
unsigned long long get_le64<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
249
684k
inline upx_uint64_t get_le64(const C<T> &a) {
250
684k
    return get_le64(a.raw_bytes(8));
251
684k
}
252
253
template <class T>
254
684k
inline void set_ne16(const C<T> &a, unsigned v) {
255
684k
    set_ne16(a.raw_bytes(2), v);
256
684k
}
257
template <class T>
258
684k
inline void set_ne24(const C<T> &a, unsigned v) {
259
684k
    set_ne24(a.raw_bytes(3), v);
260
684k
}
261
template <class T>
262
808k
inline void set_ne32(const C<T> &a, unsigned v) {
263
808k
    set_ne32(a.raw_bytes(4), v);
264
808k
}
void set_ne32<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&, unsigned int)
Line
Count
Source
262
124k
inline void set_ne32(const C<T> &a, unsigned v) {
263
124k
    set_ne32(a.raw_bytes(4), v);
264
124k
}
void set_ne32<unsigned char>(MemBufferBase<unsigned char> const&, unsigned int)
Line
Count
Source
262
684k
inline void set_ne32(const C<T> &a, unsigned v) {
263
684k
    set_ne32(a.raw_bytes(4), v);
264
684k
}
265
template <class T>
266
684k
inline void set_ne64(const C<T> &a, upx_uint64_t v) {
267
684k
    set_ne64(a.raw_bytes(8), v);
268
684k
}
269
270
template <class T>
271
684k
inline void set_be16(const C<T> &a, unsigned v) {
272
684k
    set_be16(a.raw_bytes(2), v);
273
684k
}
274
template <class T>
275
684k
inline void set_be24(const C<T> &a, unsigned v) {
276
684k
    set_be24(a.raw_bytes(3), v);
277
684k
}
278
template <class T>
279
793k
inline void set_be32(const C<T> &a, unsigned v) {
280
793k
    set_be32(a.raw_bytes(4), v);
281
793k
}
void set_be32<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&, unsigned int)
Line
Count
Source
279
109k
inline void set_be32(const C<T> &a, unsigned v) {
280
109k
    set_be32(a.raw_bytes(4), v);
281
109k
}
Unexecuted instantiation: void set_be32<unsigned char>(XSpan::Span<unsigned char> const&, unsigned int)
void set_be32<unsigned char>(MemBufferBase<unsigned char> const&, unsigned int)
Line
Count
Source
279
684k
inline void set_be32(const C<T> &a, unsigned v) {
280
684k
    set_be32(a.raw_bytes(4), v);
281
684k
}
282
template <class T>
283
699k
inline void set_be64(const C<T> &a, upx_uint64_t v) {
284
699k
    set_be64(a.raw_bytes(8), v);
285
699k
}
void set_be64<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&, unsigned long long)
Line
Count
Source
283
15.2k
inline void set_be64(const C<T> &a, upx_uint64_t v) {
284
15.2k
    set_be64(a.raw_bytes(8), v);
285
15.2k
}
void set_be64<unsigned char>(MemBufferBase<unsigned char> const&, unsigned long long)
Line
Count
Source
283
684k
inline void set_be64(const C<T> &a, upx_uint64_t v) {
284
684k
    set_be64(a.raw_bytes(8), v);
285
684k
}
286
287
template <class T>
288
684k
inline void set_le16(const C<T> &a, unsigned v) {
289
684k
    set_le16(a.raw_bytes(2), v);
290
684k
}
Unexecuted instantiation: void set_le16<unsigned char>(XSpan::Span<unsigned char> const&, unsigned int)
Unexecuted instantiation: void set_le16<unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char> const&, unsigned int)
void set_le16<unsigned char>(MemBufferBase<unsigned char> const&, unsigned int)
Line
Count
Source
288
684k
inline void set_le16(const C<T> &a, unsigned v) {
289
684k
    set_le16(a.raw_bytes(2), v);
290
684k
}
291
template <class T>
292
684k
inline void set_le24(const C<T> &a, unsigned v) {
293
684k
    set_le24(a.raw_bytes(3), v);
294
684k
}
Unexecuted instantiation: void set_le24<unsigned char>(XSpan::Span<unsigned char> const&, unsigned int)
void set_le24<unsigned char>(MemBufferBase<unsigned char> const&, unsigned int)
Line
Count
Source
292
684k
inline void set_le24(const C<T> &a, unsigned v) {
293
684k
    set_le24(a.raw_bytes(3), v);
294
684k
}
295
template <class T>
296
793k
inline void set_le32(const C<T> &a, unsigned v) {
297
793k
    set_le32(a.raw_bytes(4), v);
298
793k
}
void set_le32<unsigned char>(XSpan::Span<unsigned char> const&, unsigned int)
Line
Count
Source
296
109k
inline void set_le32(const C<T> &a, unsigned v) {
297
109k
    set_le32(a.raw_bytes(4), v);
298
109k
}
Unexecuted instantiation: void set_le32<unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char> const&, unsigned int)
void set_le32<unsigned char>(MemBufferBase<unsigned char> const&, unsigned int)
Line
Count
Source
296
684k
inline void set_le32(const C<T> &a, unsigned v) {
297
684k
    set_le32(a.raw_bytes(4), v);
298
684k
}
299
template <class T>
300
699k
inline void set_le64(const C<T> &a, upx_uint64_t v) {
301
699k
    set_le64(a.raw_bytes(8), v);
302
699k
}
void set_le64<unsigned char>(XSpan::Span<unsigned char> const&, unsigned long long)
Line
Count
Source
300
15.2k
inline void set_le64(const C<T> &a, upx_uint64_t v) {
301
15.2k
    set_le64(a.raw_bytes(8), v);
302
15.2k
}
void set_le64<unsigned char>(MemBufferBase<unsigned char> const&, unsigned long long)
Line
Count
Source
300
684k
inline void set_le64(const C<T> &a, upx_uint64_t v) {
301
684k
    set_le64(a.raw_bytes(8), v);
302
684k
}
303
304
#ifndef XSPAN_FWD_C_IS_MEMBUFFER
305
template <class T>
306
inline C<T> operator+(const C<T> &a, const BE16 &v) {
307
    return a + size_t(unsigned(v));
308
}
309
template <class T>
310
inline C<T> operator+(const C<T> &a, const BE32 &v) {
311
    return a + size_t(unsigned(v));
312
}
313
template <class T>
314
inline C<T> operator+(const C<T> &a, const LE16 &v) {
315
    return a + size_t(unsigned(v));
316
}
317
template <class T>
318
inline C<T> operator+(const C<T> &a, const LE32 &v) {
319
    return a + size_t(unsigned(v));
320
}
321
322
template <class T>
323
inline C<T> operator-(const C<T> &a, const BE16 &v) {
324
    return a - size_t(unsigned(v));
325
}
326
template <class T>
327
inline C<T> operator-(const C<T> &a, const BE32 &v) {
328
    return a - size_t(unsigned(v));
329
}
330
template <class T>
331
inline C<T> operator-(const C<T> &a, const LE16 &v) {
332
    return a - size_t(unsigned(v));
333
}
334
template <class T>
335
inline C<T> operator-(const C<T> &a, const LE32 &v) {
336
    return a - size_t(unsigned(v));
337
}
338
#endif // XSPAN_FWD_C_IS_MEMBUFFER
339
340
template <class T>
341
26.8k
inline typename std::enable_if<sizeof(T) == 1, upx_rsize_t>::type upx_safe_strlen(const C<T> &a) {
342
    // not fully checked, but can require at least 1 byte
343
26.8k
    const upx_rsize_t len = upx_safe_strlen(a.raw_bytes(1));
344
26.8k
    (void) a.raw_bytes(len + 1); // now can do a full check
345
26.8k
    return len;
346
26.8k
}
Unexecuted instantiation: std::__1::enable_if<(sizeof (char))==(1), unsigned long>::type upx_safe_strlen<char>(XSpan::Span<char> const&)
std::__1::enable_if<(sizeof (unsigned char const))==(1), unsigned long>::type upx_safe_strlen<unsigned char const>(XSpan::Span<unsigned char const> const&)
Line
Count
Source
341
26.8k
inline typename std::enable_if<sizeof(T) == 1, upx_rsize_t>::type upx_safe_strlen(const C<T> &a) {
342
    // not fully checked, but can require at least 1 byte
343
26.8k
    const upx_rsize_t len = upx_safe_strlen(a.raw_bytes(1));
344
26.8k
    (void) a.raw_bytes(len + 1); // now can do a full check
345
26.8k
    return len;
346
26.8k
}
347
348
#endif // UPX_VERSION_HEX
349
350
#undef XSPAN_FWD_TU_CONVERTIBLE
351
#undef XSPAN_FWD_TU_VOIDPTR
352
353
/* vim:set ts=4 sw=4 et: */