From eb03840af12f4585b50c3b21dc710c6fc3c659e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 11 Sep 2003 01:34:38 +0000 Subject: [PATCH] Added a BFS special endian header. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4615 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../kernel/file_systems/bfs/bfs_endian.h | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/add-ons/kernel/file_systems/bfs/bfs_endian.h diff --git a/src/add-ons/kernel/file_systems/bfs/bfs_endian.h b/src/add-ons/kernel/file_systems/bfs/bfs_endian.h new file mode 100644 index 0000000000..35a1ec78ee --- /dev/null +++ b/src/add-ons/kernel/file_systems/bfs/bfs_endian.h @@ -0,0 +1,46 @@ +/* +** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the OpenBeOS License. +*/ +#ifndef BFS_ENDIAN_H +#define BFS_ENDIAN_H + + +#include + + +#if !defined(BFS_LITTLE_ENDIAN_ONLY) && !defined(BFS_BIG_ENDIAN_ONLY) +// default setting; BFS is now primarily a little endian file system +# define BFS_LITTLE_ENDIAN_ONLY +#endif + + +#ifdef BFS_LITTLE_ENDIAN_ONLY +# if B_HOST_IS_LENDIAN +# define BFS_ENDIAN_TO_HOST_INT16(value) value +# define BFS_ENDIAN_TO_HOST_INT32(value) value +# define BFS_ENDIAN_TO_HOST_INT64(value) value +# else +# define BFS_ENDIAN_TO_HOST_INT16(value) __swap_int16(value) +# define BFS_ENDIAN_TO_HOST_INT16(value) __swap_int32(value) +# define BFS_ENDIAN_TO_HOST_INT16(value) __swap_int64(value) +# endif +#elif BFS_BIG_ENDIAN_ONLY +# if B_HOST_IS_BENDIAN +# define BFS_ENDIAN_TO_HOST_INT16(value) value +# define BFS_ENDIAN_TO_HOST_INT32(value) value +# define BFS_ENDIAN_TO_HOST_INT64(value) value +# else +# define BFS_ENDIAN_TO_HOST_INT16(value) __swap_int16(value) +# define BFS_ENDIAN_TO_HOST_INT16(value) __swap_int32(value) +# define BFS_ENDIAN_TO_HOST_INT16(value) __swap_int64(value) +# endif +#else + // ToDo: maybe build a version that supports both, big & little endian? + // But since that will need some kind of global data (to + // know of what type this file system is), it's probably + // something for the boot loader; anything else would be + // a major pain. +#endif + +#endif /* BFS_ENDIAN_H */