btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / src / add-ons / kernel / file_systems / bfs / bfs_endian.h
blob409978bf630415b502ea3cfa45d0e17d7721e818
1 /*
2 * Copyright 2003-2008, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef BFS_ENDIAN_H
6 #define BFS_ENDIAN_H
9 #include "system_dependencies.h"
12 #if !defined(BFS_LITTLE_ENDIAN_ONLY) && !defined(BFS_BIG_ENDIAN_ONLY)
13 // default setting; BFS is now primarily a little endian file system
14 # define BFS_LITTLE_ENDIAN_ONLY
15 #endif
18 #if defined(BFS_LITTLE_ENDIAN_ONLY) && B_HOST_IS_LENDIAN \
19 || defined(BFS_BIG_ENDIAN_ONLY) && B_HOST_IS_BENDIAN
20 /* host is BFS endian */
21 # define BFS_NATIVE_ENDIAN
22 # define BFS_ENDIAN_TO_HOST_INT16(value) value
23 # define BFS_ENDIAN_TO_HOST_INT32(value) value
24 # define BFS_ENDIAN_TO_HOST_INT64(value) value
25 # define HOST_ENDIAN_TO_BFS_INT16(value) value
26 # define HOST_ENDIAN_TO_BFS_INT32(value) value
27 # define HOST_ENDIAN_TO_BFS_INT64(value) value
28 #elif defined(BFS_LITTLE_ENDIAN_ONLY) && B_HOST_IS_BENDIAN \
29 || defined(BFS_BIG_ENDIAN_ONLY) && B_HOST_IS_LENDIAN
30 /* host is big endian, BFS is little endian or vice versa */
31 # define BFS_ENDIAN_TO_HOST_INT16(value) __swap_int16(value)
32 # define BFS_ENDIAN_TO_HOST_INT32(value) __swap_int32(value)
33 # define BFS_ENDIAN_TO_HOST_INT64(value) __swap_int64(value)
34 # define HOST_ENDIAN_TO_BFS_INT16(value) __swap_int16(value)
35 # define HOST_ENDIAN_TO_BFS_INT32(value) __swap_int32(value)
36 # define HOST_ENDIAN_TO_BFS_INT64(value) __swap_int64(value)
37 #else
38 // TODO: maybe build a version that supports both, big & little endian?
39 // But since that will need some kind of global data (to
40 // know of what type this file system is), it's probably
41 // something for the boot loader; anything else would be
42 // a major pain.
43 #endif
45 #endif /* BFS_ENDIAN_H */