/src/systemd/src/fundamental/unaligned-fundamental.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
2 | | #pragma once |
3 | | |
4 | | #include <stdint.h> |
5 | | |
6 | 0 | static inline uint16_t unaligned_read_ne16(const void *_u) { |
7 | 0 | const struct __attribute__((__packed__, __may_alias__)) { uint16_t x; } *u = _u; |
8 | 0 |
|
9 | 0 | return u->x; |
10 | 0 | } Unexecuted instantiation: resolved-dns-packet.c:unaligned_read_ne16 Unexecuted instantiation: resolved-dns-rr.c:unaligned_read_ne16 |
11 | | |
12 | 0 | static inline uint32_t unaligned_read_ne32(const void *_u) { |
13 | 0 | const struct __attribute__((__packed__, __may_alias__)) { uint32_t x; } *u = _u; |
14 | 0 |
|
15 | 0 | return u->x; |
16 | 0 | } Unexecuted instantiation: resolved-dns-packet.c:unaligned_read_ne32 Unexecuted instantiation: resolved-dns-rr.c:unaligned_read_ne32 |
17 | | |
18 | 0 | static inline uint64_t unaligned_read_ne64(const void *_u) { |
19 | 0 | const struct __attribute__((__packed__, __may_alias__)) { uint64_t x; } *u = _u; |
20 | 0 |
|
21 | 0 | return u->x; |
22 | 0 | } Unexecuted instantiation: resolved-dns-packet.c:unaligned_read_ne64 Unexecuted instantiation: resolved-dns-rr.c:unaligned_read_ne64 |
23 | | |
24 | 0 | static inline void unaligned_write_ne16(void *_u, uint16_t a) { |
25 | 0 | struct __attribute__((__packed__, __may_alias__)) { uint16_t x; } *u = _u; |
26 | 0 |
|
27 | 0 | u->x = a; |
28 | 0 | } Unexecuted instantiation: resolved-dns-packet.c:unaligned_write_ne16 Unexecuted instantiation: resolved-dns-rr.c:unaligned_write_ne16 |
29 | | |
30 | 0 | static inline void unaligned_write_ne32(void *_u, uint32_t a) { |
31 | 0 | struct __attribute__((__packed__, __may_alias__)) { uint32_t x; } *u = _u; |
32 | 0 |
|
33 | 0 | u->x = a; |
34 | 0 | } Unexecuted instantiation: resolved-dns-packet.c:unaligned_write_ne32 Unexecuted instantiation: resolved-dns-rr.c:unaligned_write_ne32 |
35 | | |
36 | 0 | static inline void unaligned_write_ne64(void *_u, uint64_t a) { |
37 | 0 | struct __attribute__((__packed__, __may_alias__)) { uint64_t x; } *u = _u; |
38 | 0 |
|
39 | 0 | u->x = a; |
40 | 0 | } Unexecuted instantiation: resolved-dns-packet.c:unaligned_write_ne64 Unexecuted instantiation: resolved-dns-rr.c:unaligned_write_ne64 |