1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * endian.h - Defines for endianness handling in NTFS Linux kernel driver.
4 * Part of the Linux-NTFS project.
6 * Copyright (c) 2001-2004 Anton Altaparmakov
9 #ifndef _LINUX_NTFS_ENDIAN_H
10 #define _LINUX_NTFS_ENDIAN_H
12 #include <asm/byteorder.h>
16 * Signed endianness conversion functions.
19 static inline s16
sle16_to_cpu(sle16 x
)
21 return le16_to_cpu((__force le16
)x
);
24 static inline s32
sle32_to_cpu(sle32 x
)
26 return le32_to_cpu((__force le32
)x
);
29 static inline s64
sle64_to_cpu(sle64 x
)
31 return le64_to_cpu((__force le64
)x
);
34 static inline s16
sle16_to_cpup(sle16
*x
)
36 return le16_to_cpu(*(__force le16
*)x
);
39 static inline s32
sle32_to_cpup(sle32
*x
)
41 return le32_to_cpu(*(__force le32
*)x
);
44 static inline s64
sle64_to_cpup(sle64
*x
)
46 return le64_to_cpu(*(__force le64
*)x
);
49 static inline sle16
cpu_to_sle16(s16 x
)
51 return (__force sle16
)cpu_to_le16(x
);
54 static inline sle32
cpu_to_sle32(s32 x
)
56 return (__force sle32
)cpu_to_le32(x
);
59 static inline sle64
cpu_to_sle64(s64 x
)
61 return (__force sle64
)cpu_to_le64(x
);
64 static inline sle16
cpu_to_sle16p(s16
*x
)
66 return (__force sle16
)cpu_to_le16(*x
);
69 static inline sle32
cpu_to_sle32p(s32
*x
)
71 return (__force sle32
)cpu_to_le32(*x
);
74 static inline sle64
cpu_to_sle64p(s64
*x
)
76 return (__force sle64
)cpu_to_le64(*x
);
79 #endif /* _LINUX_NTFS_ENDIAN_H */