-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid use of stdint.h in contrib/minizip.
- Loading branch information
Showing
5 changed files
with
90 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* ints.h -- create integer types for 8, 16, 32, and 64 bits | ||
* Copyright (C) 2024 Mark Adler | ||
* For conditions of distribution and use, see the copyright notice in zlib.h | ||
* | ||
* There exist compilers with limits.h, but not stdint.h or inttypes.h. | ||
*/ | ||
|
||
#ifndef INTS_H | ||
#define INTS_H | ||
#include <limits.h> | ||
#if defined(UCHAR_MAX) && UCHAR_MAX == 0xff | ||
typedef signed char i8_t; | ||
typedef unsigned char ui8_t; | ||
#else | ||
# error "no 8-bit integer" | ||
#endif | ||
#if defined(USHRT_MAX) && USHRT_MAX == 0xffff | ||
typedef short i16_t; | ||
typedef unsigned short ui16_t; | ||
#elif defined(UINT_MAX) && UINT_MAX == 0xffff | ||
typedef int i16_t; | ||
typedef unsigned ui16_t; | ||
#else | ||
# error "no 16-bit integer" | ||
#endif | ||
#if defined(UINT_MAX) && UINT_MAX == 0xffffffff | ||
typedef int i32_t; | ||
typedef unsigned ui32_t; | ||
# define PI32 "d" | ||
# define PUI32 "u" | ||
#elif defined(ULONG_MAX) && ULONG_MAX == 0xffffffff | ||
typedef long i32_t; | ||
typedef unsigned long ui32_t; | ||
# define PI32 "ld" | ||
# define PUI32 "lu" | ||
#else | ||
# error "no 32-bit integer" | ||
#endif | ||
#if defined(ULONG_MAX) && ULONG_MAX == 0xffffffffffffffff | ||
typedef long i64_t; | ||
typedef unsigned long ui64_t; | ||
# define PI64 "ld" | ||
# define PUI64 "lu" | ||
#elif defined(ULLONG_MAX) && ULLONG_MAX == 0xffffffffffffffff | ||
typedef long long i64_t; | ||
typedef unsigned long long ui64_t; | ||
# define PI64 "lld" | ||
# define PUI64 "llu" | ||
#elif defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 0xffffffffffffffff | ||
typedef long long i64_t; | ||
typedef unsigned long long ui64_t; | ||
# define PI64 "lld" | ||
# define PUI64 "llu" | ||
#else | ||
# error "no 64-bit integer" | ||
#endif | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters