Use byte-per-byte accesses when accessing possibly unaligned data.

This commit is contained in:
Reki
2022-05-03 10:20:42 +03:00
parent 1bbe9c5700
commit 7ffa952d01
4 changed files with 34 additions and 21 deletions

View File

@@ -27,3 +27,7 @@ bool is_private6(const struct sockaddr_in6* a);
int set_keepalive(int fd);
int get_so_error(int fd);
static inline uint16_t pntoh16(const uint8_t *p) {
return ((uint16_t)p[0] << 8) | (uint16_t)p[1];
}