1 /*-
2  * Copyright (c) 2005 Boris Mikhaylov
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be
13  * included in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef BS2BTYPES_H
25 #define BS2BTYPES_H
26 
27 #include <sys/types.h>
28 #include <limits.h>
29 
30 #ifndef _INT8_T_DECLARED
31 typedef signed   char    int8_t;
32 #endif
33 
34 #ifndef _UINT8_T_DECLARED
35 typedef unsigned char    uint8_t;
36 #endif
37 
38 #ifndef _INT16_T_DECLARED
39 typedef signed   short   int16_t;
40 #endif
41 
42 #ifndef _UINT16_T_DECLARED
43 typedef unsigned short   uint16_t;
44 #endif
45 
46 #ifndef _INT32_T_DECLARED
47  #if UINT_MAX == 0xffff /* 16 bit compiler */
48  typedef signed   long    int32_t;
49  #else /* UINT_MAX != 0xffff */ /* 32/64 bit compiler */
50  typedef signed   int     int32_t;
51  #endif
52 #endif /* !_INT32_T_DECLARED */
53 
54 #ifndef _UINT32_T_DECLARED
55  #if UINT_MAX == 0xffff /* 16 bit compiler */
56  typedef unsigned long    uint32_t;
57  #else /* UINT_MAX != 0xffff */ /* 32/64 bit compiler */
58  typedef unsigned int     uint32_t;
59  #endif
60 #endif /* !_UINT32_T_DECLARED */
61 
62 typedef struct
63 {
64 	uint8_t octet0;
65 	uint8_t octet1;
66 	int8_t  octet2;
67 } bs2b_int24_t;
68 
69 typedef struct
70 {
71 	uint8_t octet0;
72 	uint8_t octet1;
73 	uint8_t octet2;
74 } bs2b_uint24_t;
75 
76 #endif	/* BS2BTYPES_H */
77