-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathfat_types.h
40 lines (29 loc) · 935 Bytes
/
fat_types.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef _FAT_TYPES_H
#define _FAT_TYPES_H
#include <inttypes.h>
#include <stddef.h>
#include <stdbool.h>
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
/* Little-endian numbers that cannot be used without endianness conversion */
typedef u16 le16;
typedef u32 le32;
typedef u64 le64;
#if __BYTE_ORDER == __LITTLE_ENDIAN
# define cpu_to_le16(n) (n)
# define cpu_to_le32(n) (n)
# define cpu_to_le64(n) (n)
# define le16_to_cpu(n) (n)
# define le32_to_cpu(n) (n)
# define le64_to_cpu(n) (n)
#else /* __BYTE_ORDER == __LITTLE_ENDIAN */
# define cpu_to_le16(n) __builtin_bswap16(n)
# define cpu_to_le32(n) __builtin_bswap32(n)
# define cpu_to_le64(n) __builtin_bswap64(n)
# define le16_to_cpu(n) __builtin_bswap16(n)
# define le32_to_cpu(n) __builtin_bswap32(n)
# define le64_to_cpu(n) __builtin_bswap64(n)
#endif /* __BYTE_ORDER != __LITTLE_ENDIAN */
#endif /* _FAT_TYPES_H */