| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#pragma once |
|
2
|
|
|
|
|
|
|
#include |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
#ifdef _MSC_VER |
|
5
|
|
|
|
|
|
|
# include |
|
6
|
|
|
|
|
|
|
#endif |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
namespace panda { namespace lib { |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
namespace { |
|
11
|
|
|
|
|
|
|
union _check_endianess { unsigned x; unsigned char c; }; |
|
12
|
18
|
|
|
|
|
|
static const bool _am_i_little = (_check_endianess{1}).c; |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#ifdef _MSC_VER |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
inline uint16_t bswap16 (uint16_t x) { return _byteswap_ushort(x); } |
|
17
|
|
|
|
|
|
|
inline uint32_t bswap32 (uint32_t x) { return _byteswap_ulong(x); } |
|
18
|
|
|
|
|
|
|
inline uint64_t bswap64 (uint64_t x) { return _byteswap_uint64(x); } |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && 0 |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
inline uint16_t bswap16 (uint16_t x) { return __builtin_bswap16(x); } |
|
23
|
|
|
|
|
|
|
inline uint32_t bswap32 (uint32_t x) { return __builtin_bswap32(x); } |
|
24
|
|
|
|
|
|
|
inline uint64_t bswap64 (uint64_t x) { return __builtin_bswap64(x); } |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
#else |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
inline uint16_t bswap16 (uint16_t x) { |
|
29
|
|
|
|
|
|
|
return ((x >> 8) & 0xff) | (x << 8); |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
244162
|
|
|
|
|
|
inline uint32_t bswap32 (uint32_t x) { |
|
33
|
244162
|
|
|
|
|
|
return ((x & 0xff000000) >> 24) | ((x & 0x00ff0000) >> 8) | ((x & 0x0000ff00) << 8) | (x << 24); |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
103021
|
|
|
|
|
|
inline uint64_t bswap64 (uint64_t x) { |
|
37
|
|
|
|
|
|
|
union { uint64_t u64; uint32_t u32[2]; } v1, v2; |
|
38
|
103021
|
|
|
|
|
|
v1.u64 = x; |
|
39
|
103021
|
|
|
|
|
|
v2.u32[0] = bswap32(v1.u32[1]); |
|
40
|
103021
|
|
|
|
|
|
v2.u32[1] = bswap32(v1.u32[0]); |
|
41
|
103021
|
|
|
|
|
|
return v2.u64; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#endif |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
inline uint16_t h2be16 (uint16_t x) { return _am_i_little ? bswap16(x) : x; } |
|
49
|
|
|
|
|
|
|
inline uint16_t h2le16 (uint16_t x) { return _am_i_little ? x : bswap16(x); } |
|
50
|
|
|
|
|
|
|
inline uint16_t be2h16 (uint16_t x) { return _am_i_little ? bswap16(x) : x; } |
|
51
|
|
|
|
|
|
|
inline uint16_t le2h16 (uint16_t x) { return _am_i_little ? x : bswap16(x); } |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
inline uint32_t h2be32 (uint32_t x) { return _am_i_little ? bswap32(x) : x; } |
|
54
|
|
|
|
|
|
|
inline uint32_t h2le32 (uint32_t x) { return _am_i_little ? x : bswap32(x); } |
|
55
|
76240
|
50
|
|
|
|
|
inline uint32_t be2h32 (uint32_t x) { return _am_i_little ? bswap32(x) : x; } |
|
56
|
|
|
|
|
|
|
inline uint32_t le2h32 (uint32_t x) { return _am_i_little ? x : bswap32(x); } |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
inline uint64_t h2be64 (uint64_t x) { return _am_i_little ? bswap64(x) : x; } |
|
59
|
|
|
|
|
|
|
inline uint64_t h2le64 (uint64_t x) { return _am_i_little ? x : bswap64(x); } |
|
60
|
206042
|
50
|
|
|
|
|
inline uint64_t be2h64 (uint64_t x) { return _am_i_little ? bswap64(x) : x; } |
|
61
|
|
|
|
|
|
|
inline uint64_t le2h64 (uint64_t x) { return _am_i_little ? x : bswap64(x); } |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
inline uint16_t h2be (uint16_t x) { return h2be16(x); } |
|
64
|
|
|
|
|
|
|
inline uint16_t h2le (uint16_t x) { return h2le16(x); } |
|
65
|
|
|
|
|
|
|
inline uint16_t be2h (uint16_t x) { return be2h16(x); } |
|
66
|
|
|
|
|
|
|
inline uint16_t le2h (uint16_t x) { return le2h16(x); } |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
inline uint32_t h2be (uint32_t x) { return h2be32(x); } |
|
69
|
|
|
|
|
|
|
inline uint32_t h2le (uint32_t x) { return h2le32(x); } |
|
70
|
|
|
|
|
|
|
inline uint32_t be2h (uint32_t x) { return be2h32(x); } |
|
71
|
|
|
|
|
|
|
inline uint32_t le2h (uint32_t x) { return le2h32(x); } |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
inline uint64_t h2be (uint64_t x) { return h2be64(x); } |
|
74
|
|
|
|
|
|
|
inline uint64_t h2le (uint64_t x) { return h2le64(x); } |
|
75
|
|
|
|
|
|
|
inline uint64_t be2h (uint64_t x) { return be2h64(x); } |
|
76
|
|
|
|
|
|
|
inline uint64_t le2h (uint64_t x) { return le2h64(x); } |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
}} |