00001 /* 00002 Aseba - an event-based framework for distributed robot control 00003 Copyright (C) 2007--2012: 00004 Stephane Magnenat <stephane at magnenat dot net> 00005 (http://stephane.magnenat.net) 00006 and other contributors, see authors.txt for details 00007 00008 This program is free software: you can redistribute it and/or modify 00009 it under the terms of the GNU Lesser General Public License as published 00010 by the Free Software Foundation, version 3 of the License. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef __ASEBA_TYPES_H 00022 #define __ASEBA_TYPES_H 00023 00024 #include <stdlib.h> 00025 00028 00029 /* Typedefs to be able to run aseba-mcu on 32 bits plateforms too */ 00030 00031 typedef signed long long sint64; 00032 typedef unsigned long long uint64; 00033 typedef signed long sint32; 00034 typedef unsigned long uint32; 00035 typedef signed short sint16; 00036 typedef unsigned short uint16; 00037 typedef signed char sint8; 00038 typedef unsigned char uint8; 00039 00040 /* Aseba network protocol is little-endian, if big, swap 00041 We only need to swap 16-bit integers, as this is the largest 00042 word supported on Aseba targets. */ 00043 #ifdef __BIG_ENDIAN__ 00044 /* gcc-specific extension, but anyway __BIG_ENDIAN__ is for Mac PPC, which use gcc */ 00045 #define bswap16(v) ({uint16 _v = v; _v = (_v << 8) | (_v >> 8);}) 00046 #else 00047 #define bswap16(v) (v) 00048 #endif 00049 00052 #endif