Skip to content

Commit

Permalink
add check for C99+ to use their defs if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Yay295 committed May 18, 2023
1 parent c252734 commit fbec8f1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/libImaging/ImPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@
defines their own types with the same names, so we need to be able to undef
ours before including the JPEG code. */

#if __STDC_VERSION__ >= 199901L /* C99+ */

#include <stdint.h>

#define INT8 int8_t
#define UINT8 uint8_t
#define INT16 int16_t
#define UINT16 uint16_t
#define INT32 int32_t
#define UINT32 uint32_t
#ifdef INT64_MAX
#define INT64 int64_t
#define UINT64 uint64_t
#endif

#else /* C99+ */

#if SIZEOF_SHORT == 2
#define INT16 short
#elif SIZEOF_INT == 2
Expand Down Expand Up @@ -78,6 +95,8 @@
#define UINT64 unsigned INT64
#endif

#endif /* C99+ */

#endif /* WIN */

/* assume IEEE; tweak if necessary (patches are welcome) */
Expand Down

0 comments on commit fbec8f1

Please sign in to comment.