BRL-CAD
endian.h
Go to the documentation of this file.
1 /* E N D I A N . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2004-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 
21 /** @defgroup data Data Management */
22 /** @defgroup endian Endian Support */
23 
24 /** @file endian.h
25  *
26  */
27 #ifndef BU_ENDIAN_H
28 #define BU_ENDIAN_H
29 
30 #include "common.h"
31 #include "bu/defines.h"
32 
33 /** @addtogroup endian */
34 /** @{ */
35 /** @file libbu/endian.c
36  *
37  * Run-time byte order detection.
38  *
39  */
40 
41 typedef enum {
42  BU_LITTLE_ENDIAN = 1234, /* LSB first: i386, VAX order */
43  BU_BIG_ENDIAN = 4321, /* MSB first: 68000, IBM, network order */
44  BU_PDP_ENDIAN = 3412 /* LSB first in word, MSW first in long */
45 } bu_endian_t;
46 
47 
48 /**
49  * returns the platform byte ordering (e.g., big-/little-endian)
50  */
51 BU_EXPORT extern bu_endian_t bu_byteorder(void);
52 
53 /** @} */
54 
55 #endif /* BU_ENDIAN_H */
56 
57 /*
58  * Local Variables:
59  * mode: C
60  * tab-width: 8
61  * indent-tabs-mode: t
62  * c-file-style: "stroustrup"
63  * End:
64  * ex: shiftwidth=4 tabstop=8
65  */
bu_endian_t bu_byteorder(void)
Definition: endian.c:27
Header file for the BRL-CAD common definitions.
bu_endian_t
Definition: endian.h:41