Aseba  1.5.5
types.h
1 /*
2  Aseba - an event-based framework for distributed robot control
3  Copyright (C) 2007--2016:
4  Stephane Magnenat <stephane at magnenat dot net>
5  (http://stephane.magnenat.net)
6  and other contributors, see authors.txt for details
7 
8  This program is free software: you can redistribute it and/or modify
9  it under the terms of the GNU Lesser General Public License as published
10  by the Free Software Foundation, version 3 of the License.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef __ASEBA_TYPES_H
22 #define __ASEBA_TYPES_H
23 
24 #include <stdlib.h>
25 
28 
29 /* Typedefs to be able to run aseba-mcu on 32 bits plateforms too */
30 
31 typedef signed long long sint64;
32 typedef unsigned long long uint64;
33 typedef signed long sint32;
34 typedef unsigned long uint32;
35 typedef signed short sint16;
36 typedef unsigned short uint16;
37 typedef signed char sint8;
38 typedef unsigned char uint8;
39 
40 /* Aseba network protocol is little-endian, if big, swap
41  We only need to swap 16-bit integers, as this is the largest
42  word supported on Aseba targets. */
43 #ifdef __BIG_ENDIAN__
44 /* gcc-specific extension, but anyway __BIG_ENDIAN__ is for Mac PPC, which use gcc */
45 #define bswap16(v) ({uint16 _v = v; _v = (_v << 8) | (_v >> 8);})
46 #else
47 #define bswap16(v) (v)
48 #endif
49 
52 #endif
signed long sint32
32 bits signed integer
Definition: types.h:33
unsigned long uint32
32 bits unsigned integer
Definition: types.h:34
signed char sint8
8 bits signed integer
Definition: types.h:37
unsigned char uint8
8 bits unsigned integer
Definition: types.h:38
signed long long sint64
64 bits signed integer
Definition: types.h:31
unsigned short uint16
16 bits unsigned integer
Definition: types.h:36
signed short sint16
16 bits signed integer
Definition: types.h:35
unsigned long long uint64
64 bits unsigned integer
Definition: types.h:32