1 // -*- C++ -*-
2 /* $Id: sized_types.h,v 1.7 2002/07/23 16:28:44 t1mpy Exp $
3 
4  * id3lib: a C++ library for creating and manipulating id3v1/v2 tags Copyright
5  * 1999, 2000 Scott Thomas Haug
6 
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Library General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or (at your
10  * option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
15  * License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 
21  * The id3lib authors encourage improvements and optimisations to be sent to
22  * the id3lib coordinator.  Please see the README file for details on where to
23  * send such submissions.  See the AUTHORS file for a list of people who have
24  * contributed to id3lib.  See the ChangeLog file for a list of changes to
25  * id3lib.  These files are distributed with id3lib at
26  * http://download.sourceforge.net/id3lib/
27  */
28 
29 /**
30  ** This file defines size-specific typedefs based on the macros defined in
31  ** limits.h
32  **/
33 
34 #ifndef _SIZED_TYPES_H_
35 #define _SIZED_TYPES_H_
36 
37 #include <limits.h>
38 
39 /* define our datatypes */
40 
41 /* Define 8-bit types */
42 #if UCHAR_MAX == 0xff
43 
44 typedef unsigned char   uint8;
45 typedef signed char      int8;
46 
47 #else
48 #error This machine has no 8-bit type; report compiler, and the contents of your limits.h to the persons in the AUTHORS file
49 #endif /* UCHAR_MAX == 0xff */
50 
51 /* Define 16-bit types */
52 #if UINT_MAX == 0xffff
53 
54 typedef unsigned int    uint16;
55 typedef int              int16;
56 
57 #elif USHRT_MAX == 0xffff
58 
59 typedef unsigned short  uint16;
60 typedef short            int16;
61 
62 #else
63 #error This machine has no 16-bit type; report compiler, and the contents of your limits.h to the persons in the AUTHORS file
64 #endif /* UINT_MAX == 0xffff */
65 
66 /* Define 32-bit types */
67 #if UINT_MAX == 0xfffffffful
68 
69 typedef unsigned int    uint32;
70 typedef int              int32;
71 
72 #elif ULONG_MAX == 0xfffffffful
73 
74 typedef unsigned long   uint32;
75 typedef long             int32;
76 
77 #elif USHRT_MAX == 0xfffffffful
78 
79 typedef unsigned short  uint32;
80 typedef short            int32;
81 
82 #else
83 #error This machine has no 32-bit type; report compiler, and the contents of your limits.h to the persons in the AUTHORS file
84 #endif /* UINT_MAX == 0xfffffffful */
85 
86 #endif /* _SIZED_TYPES_H_ */
87 
88