xref: /openbsd/sys/dev/pci/drm/include/asm/byteorder.h (revision ad8b1aaf)
1 /* Public domain. */
2 
3 #ifndef _ASM_BYTEORDER_H
4 #define _ASM_BYTEORDER_H
5 
6 #include <sys/endian.h>
7 #include <linux/types.h>
8 
9 #define le16_to_cpu(x) letoh16(x)
10 #define le32_to_cpu(x) letoh32(x)
11 #define le64_to_cpu(x) letoh64(x)
12 #define be16_to_cpu(x) betoh16(x)
13 #define be32_to_cpu(x) betoh32(x)
14 #define be64_to_cpu(x) betoh64(x)
15 #define le16_to_cpup(x)	lemtoh16(x)
16 #define le32_to_cpup(x)	lemtoh32(x)
17 #define le64_to_cpup(x)	lemtoh64(x)
18 #define be16_to_cpup(x)	bemtoh16(x)
19 #define be32_to_cpup(x)	bemtoh32(x)
20 #define be64_to_cpup(x)	bemtoh64(x)
21 #define get_unaligned_le32(x)	lemtoh32(x)
22 #define cpu_to_le16(x) htole16(x)
23 #define cpu_to_le32(x) htole32(x)
24 #define cpu_to_le64(x) htole64(x)
25 #define cpu_to_be16(x) htobe16(x)
26 #define cpu_to_be32(x) htobe32(x)
27 #define cpu_to_be64(x) htobe64(x)
28 
29 #define swab16(x) swap16(x)
30 #define swab32(x) swap32(x)
31 
32 static inline void
le16_add_cpu(uint16_t * p,uint16_t n)33 le16_add_cpu(uint16_t *p, uint16_t n)
34 {
35 	htolem16(p, lemtoh16(p) + n);
36 }
37 
38 #endif
39