]>
git.proxmox.com Git - grub2.git/blob - grub-core/lib/libgcrypt-grub/src/types.h
1 /* types.h - some common typedefs
2 * Copyright (C) 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
4 * This file is part of Libgcrypt.
6 * Libgcrypt is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser general Public License as
8 * published by the Free Software Foundation; either version 2.1 of
9 * the License, or (at your option) any later version.
11 * Libgcrypt is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21 #ifndef GCRYPT_TYPES_H
22 #define GCRYPT_TYPES_H
25 /* The AC_CHECK_SIZEOF() in configure fails for some machines.
26 * we provide some fallback values here */
27 #if !SIZEOF_UNSIGNED_SHORT
28 #undef SIZEOF_UNSIGNED_SHORT
29 #define SIZEOF_UNSIGNED_SHORT 2
31 #if !SIZEOF_UNSIGNED_INT
32 #undef SIZEOF_UNSIGNED_INT
33 #define SIZEOF_UNSIGNED_INT 4
35 #if !SIZEOF_UNSIGNED_LONG
36 #undef SIZEOF_UNSIGNED_LONG
37 #define SIZEOF_UNSIGNED_LONG 4
41 #include <sys/types.h>
44 #ifndef HAVE_BYTE_TYPEDEF
45 #undef byte /* maybe there is a macro with this name */
46 /* Windows typedefs byte in the rpc headers. Avoid warning about
48 #if !(defined(_WIN32) && defined(cbNDRContext))
49 typedef unsigned char byte
;
51 #define HAVE_BYTE_TYPEDEF
54 #ifndef HAVE_USHORT_TYPEDEF
55 #undef ushort /* maybe there is a macro with this name */
56 typedef unsigned short ushort
;
57 #define HAVE_USHORT_TYPEDEF
60 #ifndef HAVE_ULONG_TYPEDEF
61 #undef ulong /* maybe there is a macro with this name */
62 typedef unsigned long ulong
;
63 #define HAVE_ULONG_TYPEDEF
66 #ifndef HAVE_U16_TYPEDEF
67 #undef u16 /* maybe there is a macro with this name */
68 #if SIZEOF_UNSIGNED_INT == 2
69 typedef unsigned int u16
;
70 #elif SIZEOF_UNSIGNED_SHORT == 2
71 typedef unsigned short u16
;
73 #error no typedef for u16
75 #define HAVE_U16_TYPEDEF
78 #ifndef HAVE_U32_TYPEDEF
79 #undef u32 /* maybe there is a macro with this name */
80 #if SIZEOF_UNSIGNED_INT == 4
81 typedef unsigned int u32
;
82 #elif SIZEOF_UNSIGNED_LONG == 4
83 typedef unsigned long u32
;
85 #error no typedef for u32
87 #define HAVE_U32_TYPEDEF
91 * Warning: Some systems segfault when this u64 typedef and
92 * the dummy code in cipher/md.c is not available. Examples are
95 #ifndef HAVE_U64_TYPEDEF
96 #undef u64 /* maybe there is a macro with this name */
97 #if SIZEOF_UNSIGNED_INT == 8
98 typedef unsigned int u64
;
99 #define U64_C(c) (c ## U)
100 #define HAVE_U64_TYPEDEF
101 #elif SIZEOF_UNSIGNED_LONG == 8
102 typedef unsigned long u64
;
103 #define U64_C(c) (c ## UL)
104 #define HAVE_U64_TYPEDEF
105 #elif SIZEOF_UNSIGNED_LONG_LONG == 8
106 typedef unsigned long long u64
;
107 #define U64_C(c) (c ## ULL)
108 #define HAVE_U64_TYPEDEF
109 #elif SIZEOF_UINT64_T == 8
110 typedef uint64_t u64
;
111 #define U64_C(c) (UINT64_C(c))
112 #define HAVE_U64_TYPEDEF
121 #ifdef HAVE_U64_TYPEDEF
126 } PROPERLY_ALIGNED_TYPE
;
128 #endif /*GCRYPT_TYPES_H*/