* include/arpa/nameser.h: Add optimizations for NS_GET16 and NS_GET32.
[glibc.git] / include / arpa / nameser.h
blob09bd5047544425d1667ca0c713e97b15e2d5d7ff
1 #include <resolv/arpa/nameser.h>
3 /* If the machine allows unaligned access we can do better than using
4 the NS_GET16, NS_GET32, NS_PUT16, and NS_PUT32 macros from the
5 installed header. */
6 #include <string.h>
7 #include <stdint.h>
8 #include <netinet/in.h>
10 #if _STRING_ARCH_unaligned
12 # undef NS_GET16
13 # define NS_GET16(s, cp) \
14 do { \
15 uint16_t *t_cp = (uint16_t *) (cp); \
16 (s) = ntohs (*t_cp); \
17 (cp) += NS_INT16SZ; \
18 } while (0)
20 # undef NS_GET32
21 # define NS_GET32(s, cp) \
22 do { \
23 uint32_t *t_cp = (uint32_t *) (cp); \
24 (s) = ntohl (*t_cp); \
25 (cp) += NS_INT32SZ; \
26 } while (0)
28 #endif