1 #include "alignment.h"
2
mbedtls_get_unaligned_uint16(const void * p)3 uint16_t mbedtls_get_unaligned_uint16(const void *p)
4 {
5 uint16_t r;
6 memcpy(&r, p, sizeof(r));
7 return r;
8 }
9
mbedtls_put_unaligned_uint16(void * p,uint16_t x)10 void mbedtls_put_unaligned_uint16(void *p, uint16_t x)
11 {
12 memcpy(p, &x, sizeof(x));
13 }
14
mbedtls_get_unaligned_uint32(const void * p)15 uint32_t mbedtls_get_unaligned_uint32(const void *p)
16 {
17 uint32_t r;
18 memcpy(&r, p, sizeof(r));
19 return r;
20 }
21
mbedtls_put_unaligned_uint32(void * p,uint32_t x)22 void mbedtls_put_unaligned_uint32(void *p, uint32_t x)
23 {
24 memcpy(p, &x, sizeof(x));
25 }
26
mbedtls_get_unaligned_uint64(const void * p)27 uint64_t mbedtls_get_unaligned_uint64(const void *p)
28 {
29 uint64_t r;
30 memcpy(&r, p, sizeof(r));
31 return r;
32 }
33
mbedtls_put_unaligned_uint64(void * p,uint64_t x)34 void mbedtls_put_unaligned_uint64(void *p, uint64_t x)
35 {
36 memcpy(p, &x, sizeof(x));
37 }