Coverage Report

Created: 2026-06-30 07:09

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
80.4k
inline int memcmp(const C<T> &a, const void *b, size_t n) {
74
80.4k
    return memcmp(a.raw_bytes(n), b, n);
75
80.4k
}
76
template <class T>
77
40.2k
inline int memcmp(const void *a, const C<T> &b, size_t n) {
78
40.2k
    return memcmp(a, b.raw_bytes(n), n);
79
40.2k
}
int memcmp<unsigned char>(void const*, MemBufferBase<unsigned char> const&, unsigned long)
Line
Count
Source
77
40.2k
inline int memcmp(const void *a, const C<T> &b, size_t n) {
78
40.2k
    return memcmp(a, b.raw_bytes(n), n);
79
40.2k
}
Unexecuted instantiation: int memcmp<unsigned char const>(void const*, XSpan::Span<unsigned char const> const&, unsigned long)
80
80.4k
XSPAN_FWD_TU_VOIDPTR(int) memcmp(const C<T> &a, const C<U> &b, size_t n) {
81
80.4k
    return memcmp(a.raw_bytes(n), b.raw_bytes(n), n);
82
80.4k
}
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.02k
inline void *memcpy(const C<T> a, const void *b, size_t n) {
96
3.02k
    return memcpy(a.raw_bytes(n), b, n);
97
3.02k
}
void* memcpy<unsigned char>(MemBufferBase<unsigned char>, void const*, unsigned long)
Line
Count
Source
95
2.74k
inline void *memcpy(const C<T> a, const void *b, size_t n) {
96
2.74k
    return memcpy(a.raw_bytes(n), b, n);
97
2.74k
}
void* memcpy<unsigned char>(XSpan::Span<unsigned char>, void const*, unsigned long)
Line
Count
Source
95
281
inline void *memcpy(const C<T> a, const void *b, size_t n) {
96
281
    return memcpy(a.raw_bytes(n), b, n);
97
281
}
Unexecuted instantiation: void* memcpy<unsigned char>(XSpan::PtrOrSpanOrNull<unsigned char>, void const*, unsigned long)
98
template <class T>
99
266
inline void *memcpy(void *a, const C<T> &b, size_t n) {
100
266
    return memcpy(a, b.raw_bytes(n), n);
101
266
}
void* memcpy<unsigned char>(void*, XSpan::Span<unsigned char> const&, unsigned long)
Line
Count
Source
99
230
inline void *memcpy(void *a, const C<T> &b, size_t n) {
100
230
    return memcpy(a, b.raw_bytes(n), n);
101
230
}
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
36
inline void *memcpy(void *a, const C<T> &b, size_t n) {
100
36
    return memcpy(a, b.raw_bytes(n), n);
101
36
}
Unexecuted instantiation: void* memcpy<PeFile::pe_section_t>(void*, XSpan::PtrOrSpanOrNull<PeFile::pe_section_t> const&, unsigned long)
102
460
XSPAN_FWD_TU_VOIDPTR(void *) memcpy(const C<T> &a, const C<U> &b, size_t n) {
103
460
    return memcpy(a.raw_bytes(n), b.raw_bytes(n), n);
104
460
}
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
10.2k
XSPAN_FWD_TU_VOIDPTR(void *) memmove(const C<T> &a, const C<U> &b, size_t n) {
125
10.2k
    return memmove(a.raw_bytes(n), b.raw_bytes(n), n);
126
10.2k
}
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
10.2k
XSPAN_FWD_TU_VOIDPTR(void *) memmove(const C<T> &a, const C<U> &b, size_t n) {
125
10.2k
    return memmove(a.raw_bytes(n), b.raw_bytes(n), n);
126
10.2k
}
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
80.4k
inline void *memset(const C<T> &a, int v, size_t n) {
140
80.4k
    return memset(a.raw_bytes(n), v, n);
141
80.4k
}
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
80.4k
inline void *memset(const C<T> &a, int v, size_t n) {
140
80.4k
    return memset(a.raw_bytes(n), v, n);
141
80.4k
}
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
51.2k
XSPAN_FWD_TU_VOIDPTR(int) ptr_diff_bytes(const C<T> &a, const C<U> &b) {
156
51.2k
    return ptr_diff_bytes(a.raw_bytes(0), b.raw_bytes(0));
157
51.2k
}
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
51.2k
XSPAN_FWD_TU_VOIDPTR(int) ptr_diff_bytes(const C<T> &a, const C<U> &b) {
156
51.2k
    return ptr_diff_bytes(a.raw_bytes(0), b.raw_bytes(0));
157
51.2k
}
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
5
inline unsigned ptr_udiff_bytes(const C<T> &a, const void *b) {
171
5
    return ptr_udiff_bytes(a.raw_bytes(0), b);
172
5
}
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
5
inline unsigned ptr_udiff_bytes(const C<T> &a, const void *b) {
171
5
    return ptr_udiff_bytes(a.raw_bytes(0), b);
172
5
}
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
241k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const C<U> &b) {
178
241k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
179
241k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpanOrNull<unsigned short> const&, XSpan::PtrOrSpanOrNull<char> const&)
Line
Count
Source
177
80.4k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const C<U> &b) {
178
80.4k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
179
80.4k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpan<unsigned short> const&, XSpan::PtrOrSpan<char> const&)
Line
Count
Source
177
80.4k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const C<U> &b) {
178
80.4k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
179
80.4k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::Span<unsigned short> const&, XSpan::Span<char> const&)
Line
Count
Source
177
80.4k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const C<U> &b) {
178
80.4k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
179
80.4k
}
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
241k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const D<U> &b) {
182
241k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
183
241k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpan<unsigned short> const&, XSpan::PtrOrSpanOrNull<char> const&)
Line
Count
Source
181
80.4k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const D<U> &b) {
182
80.4k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
183
80.4k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::Span<unsigned short> const&, XSpan::PtrOrSpanOrNull<char> const&)
Line
Count
Source
181
80.4k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const D<U> &b) {
182
80.4k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
183
80.4k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpanOrNull<unsigned short> const&, XSpan::PtrOrSpan<char> const&)
Line
Count
Source
181
80.4k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const D<U> &b) {
182
80.4k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
183
80.4k
}
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
241k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const E<U> &b) {
187
241k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
188
241k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::Span<unsigned short> const&, XSpan::PtrOrSpan<char> const&)
Line
Count
Source
186
80.4k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const E<U> &b) {
187
80.4k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
188
80.4k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpanOrNull<unsigned short> const&, XSpan::Span<char> const&)
Line
Count
Source
186
80.4k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const E<U> &b) {
187
80.4k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
188
80.4k
}
unsigned int ptr_udiff_bytes<unsigned short, char>(XSpan::PtrOrSpan<unsigned short> const&, XSpan::Span<char> const&)
Line
Count
Source
186
80.4k
XSPAN_FWD_TU_VOIDPTR(unsigned) ptr_udiff_bytes(const C<T> &a, const E<U> &b) {
187
80.4k
    return ptr_udiff_bytes(a.raw_bytes(0), b.raw_bytes(0));
188
80.4k
}
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
643k
inline unsigned get_ne16(const C<T> &a) {
204
643k
    return get_ne16(a.raw_bytes(2));
205
643k
}
206
template <class T>
207
643k
inline unsigned get_ne24(const C<T> &a) {
208
643k
    return get_ne24(a.raw_bytes(3));
209
643k
}
210
template <class T>
211
694k
inline unsigned get_ne32(const C<T> &a) {
212
694k
    return get_ne32(a.raw_bytes(4));
213
694k
}
unsigned int get_ne32<unsigned char const>(XSpan::PtrOrSpan<unsigned char const> const&)
Line
Count
Source
211
51.2k
inline unsigned get_ne32(const C<T> &a) {
212
51.2k
    return get_ne32(a.raw_bytes(4));
213
51.2k
}
unsigned int get_ne32<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
211
643k
inline unsigned get_ne32(const C<T> &a) {
212
643k
    return get_ne32(a.raw_bytes(4));
213
643k
}
214
template <class T>
215
643k
inline upx_uint64_t get_ne64(const C<T> &a) {
216
643k
    return get_ne64(a.raw_bytes(8));
217
643k
}
218
219
template <class T>
220
643k
inline unsigned get_be16(const C<T> &a) {
221
643k
    return get_be16(a.raw_bytes(2));
222
643k
}
223
template <class T>
224
643k
inline unsigned get_be24(const C<T> &a) {
225
643k
    return get_be24(a.raw_bytes(3));
226
643k
}
227
template <class T>
228
654k
inline unsigned get_be32(const C<T> &a) {
229
654k
    return get_be32(a.raw_bytes(4));
230
654k
}
unsigned int get_be32<unsigned char const>(XSpan::Span<unsigned char const> const&)
Line
Count
Source
228
10.8k
inline unsigned get_be32(const C<T> &a) {
229
10.8k
    return get_be32(a.raw_bytes(4));
230
10.8k
}
unsigned int get_be32<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
228
643k
inline unsigned get_be32(const C<T> &a) {
229
643k
    return get_be32(a.raw_bytes(4));
230
643k
}
231
template <class T>
232
643k
inline upx_uint64_t get_be64(const C<T> &a) {
233
643k
    return get_be64(a.raw_bytes(8));
234
643k
}
235
236
template <class T>
237
646k
inline unsigned get_le16(const C<T> &a) {
238
646k
    return get_le16(a.raw_bytes(2));
239
646k
}
unsigned int get_le16<unsigned char>(XSpan::Span<unsigned char> const&)
Line
Count
Source
237
93
inline unsigned get_le16(const C<T> &a) {
238
93
    return get_le16(a.raw_bytes(2));
239
93
}
unsigned int get_le16<unsigned char const>(XSpan::Span<unsigned char const> const&)
Line
Count
Source
237
3.37k
inline unsigned get_le16(const C<T> &a) {
238
3.37k
    return get_le16(a.raw_bytes(2));
239
3.37k
}
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
643k
inline unsigned get_le16(const C<T> &a) {
238
643k
    return get_le16(a.raw_bytes(2));
239
643k
}
240
template <class T>
241
644k
inline unsigned get_le24(const C<T> &a) {
242
644k
    return get_le24(a.raw_bytes(3));
243
644k
}
unsigned int get_le24<unsigned char const>(XSpan::Span<unsigned char const> const&)
Line
Count
Source
241
1.26k
inline unsigned get_le24(const C<T> &a) {
242
1.26k
    return get_le24(a.raw_bytes(3));
243
1.26k
}
unsigned int get_le24<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
241
643k
inline unsigned get_le24(const C<T> &a) {
242
643k
    return get_le24(a.raw_bytes(3));
243
643k
}
244
template <class T>
245
1.01M
inline unsigned get_le32(const C<T> &a) {
246
1.01M
    return get_le32(a.raw_bytes(4));
247
1.01M
}
unsigned int get_le32<unsigned char const>(XSpan::Span<unsigned char const> const&)
Line
Count
Source
245
190k
inline unsigned get_le32(const C<T> &a) {
246
190k
    return get_le32(a.raw_bytes(4));
247
190k
}
unsigned int get_le32<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
245
643k
inline unsigned get_le32(const C<T> &a) {
246
643k
    return get_le32(a.raw_bytes(4));
247
643k
}
unsigned int get_le32<unsigned char>(XSpan::Span<unsigned char> const&)
Line
Count
Source
245
143k
inline unsigned get_le32(const C<T> &a) {
246
143k
    return get_le32(a.raw_bytes(4));
247
143k
}
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
41.0k
inline unsigned get_le32(const C<T> &a) {
246
41.0k
    return get_le32(a.raw_bytes(4));
247
41.0k
}
248
template <class T>
249
663k
inline upx_uint64_t get_le64(const C<T> &a) {
250
663k
    return get_le64(a.raw_bytes(8));
251
663k
}
unsigned long long get_le64<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&)
Line
Count
Source
249
10.1k
inline upx_uint64_t get_le64(const C<T> &a) {
250
10.1k
    return get_le64(a.raw_bytes(8));
251
10.1k
}
unsigned long long get_le64<unsigned char>(XSpan::Span<unsigned char> const&)
Line
Count
Source
249
10.1k
inline upx_uint64_t get_le64(const C<T> &a) {
250
10.1k
    return get_le64(a.raw_bytes(8));
251
10.1k
}
unsigned long long get_le64<unsigned char>(MemBufferBase<unsigned char> const&)
Line
Count
Source
249
643k
inline upx_uint64_t get_le64(const C<T> &a) {
250
643k
    return get_le64(a.raw_bytes(8));
251
643k
}
252
253
template <class T>
254
643k
inline void set_ne16(const C<T> &a, unsigned v) {
255
643k
    set_ne16(a.raw_bytes(2), v);
256
643k
}
257
template <class T>
258
643k
inline void set_ne24(const C<T> &a, unsigned v) {
259
643k
    set_ne24(a.raw_bytes(3), v);
260
643k
}
261
template <class T>
262
694k
inline void set_ne32(const C<T> &a, unsigned v) {
263
694k
    set_ne32(a.raw_bytes(4), v);
264
694k
}
void set_ne32<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&, unsigned int)
Line
Count
Source
262
51.2k
inline void set_ne32(const C<T> &a, unsigned v) {
263
51.2k
    set_ne32(a.raw_bytes(4), v);
264
51.2k
}
void set_ne32<unsigned char>(MemBufferBase<unsigned char> const&, unsigned int)
Line
Count
Source
262
643k
inline void set_ne32(const C<T> &a, unsigned v) {
263
643k
    set_ne32(a.raw_bytes(4), v);
264
643k
}
265
template <class T>
266
643k
inline void set_ne64(const C<T> &a, upx_uint64_t v) {
267
643k
    set_ne64(a.raw_bytes(8), v);
268
643k
}
269
270
template <class T>
271
643k
inline void set_be16(const C<T> &a, unsigned v) {
272
643k
    set_be16(a.raw_bytes(2), v);
273
643k
}
274
template <class T>
275
643k
inline void set_be24(const C<T> &a, unsigned v) {
276
643k
    set_be24(a.raw_bytes(3), v);
277
643k
}
278
template <class T>
279
684k
inline void set_be32(const C<T> &a, unsigned v) {
280
684k
    set_be32(a.raw_bytes(4), v);
281
684k
}
void set_be32<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&, unsigned int)
Line
Count
Source
279
41.0k
inline void set_be32(const C<T> &a, unsigned v) {
280
41.0k
    set_be32(a.raw_bytes(4), v);
281
41.0k
}
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
643k
inline void set_be32(const C<T> &a, unsigned v) {
280
643k
    set_be32(a.raw_bytes(4), v);
281
643k
}
282
template <class T>
283
653k
inline void set_be64(const C<T> &a, upx_uint64_t v) {
284
653k
    set_be64(a.raw_bytes(8), v);
285
653k
}
void set_be64<unsigned char>(XSpan::PtrOrSpan<unsigned char> const&, unsigned long long)
Line
Count
Source
283
10.1k
inline void set_be64(const C<T> &a, upx_uint64_t v) {
284
10.1k
    set_be64(a.raw_bytes(8), v);
285
10.1k
}
void set_be64<unsigned char>(MemBufferBase<unsigned char> const&, unsigned long long)
Line
Count
Source
283
643k
inline void set_be64(const C<T> &a, upx_uint64_t v) {
284
643k
    set_be64(a.raw_bytes(8), v);
285
643k
}
286
287
template <class T>
288
643k
inline void set_le16(const C<T> &a, unsigned v) {
289
643k
    set_le16(a.raw_bytes(2), v);
290
643k
}
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
643k
inline void set_le16(const C<T> &a, unsigned v) {
289
643k
    set_le16(a.raw_bytes(2), v);
290
643k
}
291
template <class T>
292
643k
inline void set_le24(const C<T> &a, unsigned v) {
293
643k
    set_le24(a.raw_bytes(3), v);
294
643k
}
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
643k
inline void set_le24(const C<T> &a, unsigned v) {
293
643k
    set_le24(a.raw_bytes(3), v);
294
643k
}
295
template <class T>
296
684k
inline void set_le32(const C<T> &a, unsigned v) {
297
684k
    set_le32(a.raw_bytes(4), v);
298
684k
}
void set_le32<unsigned char>(XSpan::Span<unsigned char> const&, unsigned int)
Line
Count
Source
296
41.0k
inline void set_le32(const C<T> &a, unsigned v) {
297
41.0k
    set_le32(a.raw_bytes(4), v);
298
41.0k
}
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
643k
inline void set_le32(const C<T> &a, unsigned v) {
297
643k
    set_le32(a.raw_bytes(4), v);
298
643k
}
299
template <class T>
300
653k
inline void set_le64(const C<T> &a, upx_uint64_t v) {
301
653k
    set_le64(a.raw_bytes(8), v);
302
653k
}
void set_le64<unsigned char>(XSpan::Span<unsigned char> const&, unsigned long long)
Line
Count
Source
300
10.1k
inline void set_le64(const C<T> &a, upx_uint64_t v) {
301
10.1k
    set_le64(a.raw_bytes(8), v);
302
10.1k
}
void set_le64<unsigned char>(MemBufferBase<unsigned char> const&, unsigned long long)
Line
Count
Source
300
643k
inline void set_le64(const C<T> &a, upx_uint64_t v) {
301
643k
    set_le64(a.raw_bytes(8), v);
302
643k
}
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
20.4k
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
20.4k
    upx_rsize_t len = upx_safe_strlen(a.raw_bytes(1));
344
20.4k
    (void) a.raw_bytes(len + 1); // now can do a full check
345
20.4k
    return len;
346
20.4k
}
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
20.4k
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
20.4k
    upx_rsize_t len = upx_safe_strlen(a.raw_bytes(1));
344
20.4k
    (void) a.raw_bytes(len + 1); // now can do a full check
345
20.4k
    return len;
346
20.4k
}
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: */