GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-d6dec75dd4
endian.c
Go to the documentation of this file.
1
/*!
2
* \file lib/gis/endian.c
3
*
4
* \brief GIS Library - Functions to determine architecture endian.
5
*
6
* This endian test was taken from ./src.contrib/GMSL/NVIZ2.2/TOGL/apps/image.c.
7
*
8
* (C) 2001-2009 by the GRASS Development Team
9
*
10
* This program is free software under the GNU General Public License
11
* (>=v2). Read the file COPYING that comes with GRASS for details.
12
*
13
* \author Markus Neteler
14
*/
15
16
/*!
17
* \brief Tests for little ENDIAN.
18
*
19
* Test if machine is little or big endian.
20
*
21
* \return 1 little endian
22
* \return 0 big endian
23
*/
24
int
G_is_little_endian
(
void
)
25
{
26
union
{
27
int
testWord;
28
char
testByte[
sizeof
(int)];
29
} endianTest;
30
31
endianTest.testWord = 1;
32
33
if
(endianTest.testByte[0] == 1)
34
return
1;
/* true: little endian */
35
36
return
0;
/* false: big endian */
37
}
G_is_little_endian
int G_is_little_endian(void)
Tests for little ENDIAN.
Definition:
endian.c:24
lib
gis
endian.c
Generated on Sun Dec 22 2024 07:38:13 for GRASS GIS 8 Programmer's Manual by
1.9.1