native.c revision 9f8046fc6dfc13eee2f5c363214e60b533872cac
1/*
2 * native.c --- returns the ext2_flag for a native byte order
3 *
4 * Copyright (C) 1996 Theodore Ts'o.
5 *
6 * %Begin-Header%
7 * This file may be redistributed under the terms of the GNU Public
8 * License.
9 * %End-Header%
10 */
11
12#include <stdio.h>
13
14#include "ext2_fs.h"
15#include "ext2fs.h"
16
17static int i386_byteorder(void)
18{
19	int one = 1;
20	char *cp = (char *) &one;
21
22	return (*cp == 1);
23}
24
25int ext2fs_native_flag(void)
26{
27	if (i386_byteorder())
28		return 0;
29	return EXT2_FLAG_SWAP_BYTES;
30}
31
32
33
34