Skip to content

Commit

Permalink
Only defined fixed-width types if not already defined.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoinvaz committed Nov 27, 2018
1 parent f9e3448 commit 4ff891a
Showing 1 changed file with 47 additions and 10 deletions.
57 changes: 47 additions & 10 deletions mz.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,33 +152,72 @@

#ifdef HAVE_STDINT_H
# include <stdint.h>
#else
#endif

#ifndef __INT8_TYPE__
typedef signed char int8_t;
#endif
#ifndef __INT16_TYPE__
typedef short int16_t;
#endif
#ifndef __INT32_TYPE__
typedef int int32_t;
#endif
#ifndef __INT64_TYPE__
typedef long long int64_t;
#endif
#ifndef __UINT8_TYPE__
typedef unsigned char uint8_t;
#endif
#ifndef __UINT16_TYPE__
typedef unsigned short uint16_t;
#endif
#ifndef __UINT32_TYPE__
typedef unsigned int uint32_t;
#endif
#ifndef __UINT64_TYPE__
typedef unsigned long long uint64_t;
#endif

#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#else
#endif

#ifndef PRId8
# define PRId8 "hhd"
#endif
#ifndef PRId16
# define PRId16 "hd"
#endif
#ifndef PRId32
# define PRId32 "d"
#endif
#ifndef PRIu32
# define PRIu32 "u"
#endif
#ifndef PRIx32
# define PRIx32 "x"
#endif
# if ULONG_MAX == 4294967295UL
# define PRId64 "lld"
# define PRIu64 "llu"
# define PRIx64 "llx"
# ifndef PRId64
# define PRId64 "lld"
# endif
# ifndef PRIu64
# define PRIu64 "llu"
# endif
# ifndef PRIx64
# define PRIx64 "llx"
# endif
# else
# define PRId64 "ld"
# define PRIu64 "lu"
# define PRIx64 "lx"
# ifndef PRId64
# define PRId64 "ld"
# endif
# ifndef PRIu64
# define PRIu64 "lu"
# endif
# ifndef PRIx64
# define PRIx64 "lx"
# endif
# endif
#endif

Expand All @@ -202,5 +241,3 @@ typedef unsigned long long uint64_t;
#endif

/***************************************************************************/

#endif

0 comments on commit 4ff891a

Please sign in to comment.