Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / fs / ntfs / endian.h
blob927b5bf04b4fc72659ae34d480b34522a2c71b38
1 /*
2 * endian.h - Defines for endianness handling in NTFS Linux kernel driver.
3 * Part of the Linux-NTFS project.
5 * Copyright (c) 2001-2004 Anton Altaparmakov
7 * This program/include file is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program/include file is distributed in the hope that it will be
13 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program (in the main directory of the Linux-NTFS
19 * distribution in the file COPYING); if not, write to the Free Software
20 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #ifndef _LINUX_NTFS_ENDIAN_H
24 #define _LINUX_NTFS_ENDIAN_H
26 #include <asm/byteorder.h>
27 #include "types.h"
30 * Signed endianness conversion functions.
33 static inline s16 sle16_to_cpu(sle16 x)
35 return le16_to_cpu((__force le16)x);
38 static inline s32 sle32_to_cpu(sle32 x)
40 return le32_to_cpu((__force le32)x);
43 static inline s64 sle64_to_cpu(sle64 x)
45 return le64_to_cpu((__force le64)x);
48 static inline s16 sle16_to_cpup(sle16 *x)
50 return le16_to_cpu(*(__force le16*)x);
53 static inline s32 sle32_to_cpup(sle32 *x)
55 return le32_to_cpu(*(__force le32*)x);
58 static inline s64 sle64_to_cpup(sle64 *x)
60 return le64_to_cpu(*(__force le64*)x);
63 static inline sle16 cpu_to_sle16(s16 x)
65 return (__force sle16)cpu_to_le16(x);
68 static inline sle32 cpu_to_sle32(s32 x)
70 return (__force sle32)cpu_to_le32(x);
73 static inline sle64 cpu_to_sle64(s64 x)
75 return (__force sle64)cpu_to_le64(x);
78 static inline sle16 cpu_to_sle16p(s16 *x)
80 return (__force sle16)cpu_to_le16(*x);
83 static inline sle32 cpu_to_sle32p(s32 *x)
85 return (__force sle32)cpu_to_le32(*x);
88 static inline sle64 cpu_to_sle64p(s64 *x)
90 return (__force sle64)cpu_to_le64(*x);
93 #endif /* _LINUX_NTFS_ENDIAN_H */