blob: 5f46eee23c3854a030b91dc15a7045fe20f4aafb [file] [log] [blame]
Stefan Roese371abe82009-03-19 15:34:56 +01001#ifndef _LINUX_UNALIGNED_ACCESS_OK_H
2#define _LINUX_UNALIGNED_ACCESS_OK_H
3
4#include <asm/byteorder.h>
5
6static inline u16 get_unaligned_le16(const void *p)
7{
8 return le16_to_cpup((__le16 *)p);
9}
10
11static inline u32 get_unaligned_le32(const void *p)
12{
13 return le32_to_cpup((__le32 *)p);
14}
15
16static inline u64 get_unaligned_le64(const void *p)
17{
18 return le64_to_cpup((__le64 *)p);
19}
20
21static inline u16 get_unaligned_be16(const void *p)
22{
23 return be16_to_cpup((__be16 *)p);
24}
25
26static inline u32 get_unaligned_be32(const void *p)
27{
28 return be32_to_cpup((__be32 *)p);
29}
30
31static inline u64 get_unaligned_be64(const void *p)
32{
33 return be64_to_cpup((__be64 *)p);
34}
35
36static inline void put_unaligned_le16(u16 val, void *p)
37{
38 *((__le16 *)p) = cpu_to_le16(val);
39}
40
41static inline void put_unaligned_le32(u32 val, void *p)
42{
43 *((__le32 *)p) = cpu_to_le32(val);
44}
45
46static inline void put_unaligned_le64(u64 val, void *p)
47{
48 *((__le64 *)p) = cpu_to_le64(val);
49}
50
51static inline void put_unaligned_be16(u16 val, void *p)
52{
53 *((__be16 *)p) = cpu_to_be16(val);
54}
55
56static inline void put_unaligned_be32(u32 val, void *p)
57{
58 *((__be32 *)p) = cpu_to_be32(val);
59}
60
61static inline void put_unaligned_be64(u64 val, void *p)
62{
63 *((__be64 *)p) = cpu_to_be64(val);
64}
65
66#endif /* _LINUX_UNALIGNED_ACCESS_OK_H */