Whamcloud - gitweb
Many files:
[tools/e2fsprogs.git] / lib / ext2fs / native.c
1 /*
2  * native.c --- returns the ext2_flag for a native byte order
3  * 
4  * Copyright (C) 1996 Theodore Ts'o.
5  * 
6  * This file may be redistributed under the terms of the GNU Public
7  * License.
8  */
9
10 #include <stdio.h>
11 #include <linux/ext2_fs.h>
12
13 #include "ext2fs.h"
14
15 static int i386_byteorder(void)
16 {
17         int one = 1;
18         char *cp = (char *) &one;
19
20         return (*cp == 1);
21 }
22
23 int ext2fs_native_flag(void)
24 {
25         if (i386_byteorder())
26                 return 0;
27         return EXT2_SWAP_BYTES;
28 }
29
30         
31