GRASS 8 Programmer's Manual
8.6.0dev(2026)-55de52a352
Loading...
Searching...
No Matches
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
* SPDX-FileCopyrightText: 2001-2009 GRASS Development Team
9
* SPDX-License-Identifier: GPL-2.0-or-later
10
*
11
* \author Markus Neteler
12
*/
13
14
/*!
15
* \brief Tests for little ENDIAN.
16
*
17
* Test if machine is little or big endian.
18
*
19
* \return 1 little endian
20
* \return 0 big endian
21
*/
22
int
G_is_little_endian
(
void
)
23
{
24
union
{
25
int
testWord
;
26
char
testByte
[
sizeof
(
int
)];
27
}
endianTest
;
28
29
endianTest
.testWord = 1;
30
31
if
(
endianTest
.testByte[0] == 1)
32
return
1;
/* true: little endian */
33
34
return
0;
/* false: big endian */
35
}
AMI_STREAM
Definition
ami_stream.h:153
G_is_little_endian
int G_is_little_endian(void)
Tests for little ENDIAN.
Definition
endian.c:22
lib
gis
endian.c
Generated on Thu Sep 10 2026 06:57:37 for GRASS 8 Programmer's Manual by
1.9.8