2 * Navit, a modular navigation system.
3 * Copyright (C) 2005-2008 Navit Team
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public License
7 * version 2 as published by the Free Software Foundation.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
25 #ifdef WORDS_BIGENDIAN
29 static inline unsigned char
30 get_u8(unsigned char **p)
35 static inline unsigned short
36 get_u16(unsigned char **p) {
38 ret=*((unsigned short *)*p);
39 *p+=sizeof(unsigned short);
40 #ifdef WORDS_BIGENDIAN
41 return __bswap_16(ret);
47 static inline unsigned short
48 get_u16_unal(unsigned char **p) {
56 static inline unsigned int
57 get_u24(unsigned char **p) {
65 static inline unsigned int
66 get_u24_unal(unsigned char **p) {
74 static inline unsigned int
75 get_u32(unsigned char **p) {
77 ret=*((unsigned int *)*p);
78 *p+=sizeof(unsigned int);
79 #ifdef WORDS_BIGENDIAN
80 return __bswap_32(ret);
86 static inline unsigned int
87 get_u32_unal(unsigned char **p) {
97 get_string(unsigned char **p)
99 char *ret=(char *)(*p);
105 #define L(x) ({ unsigned char *t=(unsigned char *)&(x); t[0] | (t[1] << 8) | (t[2] << 16) | (t[3] << 24); })