gwenhywfar 5.11.1beta
endianfns.h
Go to the documentation of this file.
1/***************************************************************************
2 begin : Tuet Apr 26 2016
3 copyright : (C) 2016 by Martin Preuss
4 email : martin@libchipcard.de
5
6 ***************************************************************************
7 * *
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
21 * MA 02111-1307 USA *
22 * *
23 ***************************************************************************/
24
25#ifndef GWENHYWFAR_ENDIANFNS_H
26#define GWENHYWFAR_ENDIANFNS_H
27
29
30
31#if GWENHYWFAR_SYS_IS_WINDOWS
32/* assume little endian for now (is there any big endian Windows system??) */
33# define GWEN_ENDIAN_LE16TOH(x) (x)
34# define GWEN_ENDIAN_HTOLE16(x) (x)
35
36# define GWEN_ENDIAN_LE32TOH(x) (x)
37# define GWEN_ENDIAN_HTOLE32(x) (x)
38
39# define GWEN_ENDIAN_LE64TOH(x) (x)
40# define GWEN_ENDIAN_HTOLE64(x) (x)
41#else
42/* for Linux and others use definitions from endian.h */
43# include <endian.h>
44
45# define GWEN_ENDIAN_LE16TOH(x) le16toh(x)
46# define GWEN_ENDIAN_HTOLE16(x) htole16(x)
47
48# define GWEN_ENDIAN_LE32TOH(x) le32toh(x)
49# define GWEN_ENDIAN_HTOLE32(x) htole32(x)
50
51# define GWEN_ENDIAN_LE64TOH(x) le64toh(x)
52# define GWEN_ENDIAN_HTOLE64(x) htole64(x)
53#endif
54
55
56
57
58#endif