blob: 2ea854991fb71005a214853c3d3c860993f8bb85 [file] [log] [blame]
Theodore Ts'o1e3472c1997-04-29 14:53:37 +00001/*
2 * native.c --- returns the ext2_flag for a native byte order
3 *
4 * Copyright (C) 1996 Theodore Ts'o.
5 *
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00006 * %Begin-Header%
Theodore Ts'o1e3472c1997-04-29 14:53:37 +00007 * This file may be redistributed under the terms of the GNU Public
8 * License.
Theodore Ts'o19c78dc1997-04-29 16:17:09 +00009 * %End-Header%
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000010 */
11
12#include <stdio.h>
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +000013
14#if EXT2_FLAT_INCLUDES
15#include "ext2_fs.h"
16#else
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000017#include <linux/ext2_fs.h>
Theodore Ts'ob5abe6f1998-01-19 14:47:53 +000018#endif
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000019
20#include "ext2fs.h"
21
22static int i386_byteorder(void)
23{
24 int one = 1;
25 char *cp = (char *) &one;
26
27 return (*cp == 1);
28}
29
30int ext2fs_native_flag(void)
31{
32 if (i386_byteorder())
33 return 0;
Theodore Ts'o5c576471997-04-29 15:29:49 +000034 return EXT2_FLAG_SWAP_BYTES;
Theodore Ts'o1e3472c1997-04-29 14:53:37 +000035}
36
37
38