00001 // -*- C++ -*- 00002 /* $Id: sized_types.h,v 1.6 2000/10/23 04:32:33 eldamitri Exp $ 00003 00004 * id3lib: a C++ library for creating and manipulating id3v1/v2 tags Copyright 00005 * 1999, 2000 Scott Thomas Haug 00006 00007 * This library is free software; you can redistribute it and/or modify it 00008 * under the terms of the GNU Library General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or (at your 00010 * option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00014 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00015 * License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public License 00018 * along with this library; if not, write to the Free Software Foundation, 00019 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 00021 * The id3lib authors encourage improvements and optimisations to be sent to 00022 * the id3lib coordinator. Please see the README file for details on where to 00023 * send such submissions. See the AUTHORS file for a list of people who have 00024 * contributed to id3lib. See the ChangeLog file for a list of changes to 00025 * id3lib. These files are distributed with id3lib at 00026 * http://download.sourceforge.net/id3lib/ 00027 */ 00028 00034 #ifndef _SIZED_TYPES_H_ 00035 #define _SIZED_TYPES_H_ 00036 00037 #include <limits.h> 00038 00039 /* define our datatypes */ 00040 00041 /* Define 8-bit types */ 00042 #if UCHAR_MAX == 0xff 00043 00044 typedef unsigned char uint8; 00045 typedef signed char int8; 00046 00047 #else 00048 #error This machine has no 8-bit type 00049 #endif /* UCHAR_MAX == 0xff */ 00050 00051 /* Define 16-bit types */ 00052 #if UINT_MAX == 0xffff 00053 00054 typedef unsigned int uint16; 00055 typedef int int16; 00056 00057 #elif USHRT_MAX == 0xffff 00058 00059 typedef unsigned short uint16; 00060 typedef short int16; 00061 00062 #else 00063 #error This machine has no 16-bit type 00064 #endif /* UINT_MAX == 0xffff */ 00065 00066 /* Define 32-bit types */ 00067 #if UINT_MAX == 0xfffffffful 00068 00069 typedef unsigned int uint32; 00070 typedef int int32; 00071 00072 #elif ULONG_MAX == 0xfffffffful 00073 00074 typedef unsigned long uint32; 00075 typedef long int32; 00076 00077 #elif USHRT_MAX == 0xfffffffful 00078 00079 typedef unsigned short uint32; 00080 typedef short int32; 00081 00082 #else 00083 #error This machine has no 32-bit type 00084 #endif /* UINT_MAX == 0xfffffffful */ 00085 00086 #endif /* _SIZED_TYPES_H_ */ 00087