#ifndef BITTYPES_H_INCLUDED
#define BITTYPES_H_INCLUDED

#include <config.h>

#if SIZEOF_CHAR == 1
typedef signed char int8;
#else
#error sizeof(char) is not equal to 8
#endif

#if SIZEOF_UNSIGNED_CHAR == 1
typedef unsigned char uint8;
#else
#error sizeof(unsigned char) is not equal to 8
#endif

#if SIZEOF_SHORT == 2
typedef short int16;
#elif SIZEOF_INT == 2
typedef int int16;
#else
#error Unable to find type for int16
#endif

#if SIZEOF_UNSIGNED_SHORT == 2
typedef unsigned short uint16;
#elif SIZEOF_UNSIGNED_INT == 2
typedef unsigned int uint16;
#elif SIZEOF_UNSIGNED_LONG == 2
typedef unsigned long uint16;
#else
#error Unable to find type for uint16
#endif

#if SIZEOF_INT == 4
typedef int int32;
#elif SIZEOF_LONG == 4
typedef long int32;
#elif SIZEOF_SHORT == 4
typedef short int32;
#else
#error Unable to find type for int32
#endif

#if SIZEOF_UNSIGNED_INT == 4
typedef unsigned int uint32;
#elif SIZEOF_UNSIGNED_LONG == 4
typedef unsigned long uint32;
#elif SIZEOF_UNSIGNED_SHORT == 4
typedef unsigned short uint32;
#else
#error Unable to find type for uint32!!!!
#endif

#endif
