diff --git a/libretro-common/include/file/config_file.h b/libretro-common/include/file/config_file.h index adaaa28cdb..8a3ad49b61 100644 --- a/libretro-common/include/file/config_file.h +++ b/libretro-common/include/file/config_file.h @@ -28,11 +28,12 @@ extern "C" { #endif -#include -#include #include +#include #include +#include + struct config_entry_list { /* If we got this from an #include, diff --git a/libretro-common/include/file/config_file_userdata.h b/libretro-common/include/file/config_file_userdata.h index 604bffcd3d..1add87ef49 100644 --- a/libretro-common/include/file/config_file_userdata.h +++ b/libretro-common/include/file/config_file_userdata.h @@ -24,6 +24,7 @@ #define _LIBRETRO_SDK_CONFIG_FILE_USERDATA_H #include + #include "config_file.h" struct config_file_userdata diff --git a/libretro-common/include/file/file_extract.h b/libretro-common/include/file/file_extract.h index 388592346f..6afac0ef7b 100644 --- a/libretro-common/include/file/file_extract.h +++ b/libretro-common/include/file/file_extract.h @@ -23,9 +23,10 @@ #ifndef FILE_EXTRACT_H__ #define FILE_EXTRACT_H__ -#include -#include #include +#include + +#include typedef struct zlib_handle { diff --git a/libretro-common/include/file/file_path.h b/libretro-common/include/file/file_path.h index e36f174d74..01bf401dd1 100644 --- a/libretro-common/include/file/file_path.h +++ b/libretro-common/include/file/file_path.h @@ -23,12 +23,12 @@ #ifndef __LIBRETRO_SDK_FILE_PATH_H #define __LIBRETRO_SDK_FILE_PATH_H -#include #include #include #include #include +#include #include #ifdef __cplusplus diff --git a/libretro-common/include/file/memory_stream.h b/libretro-common/include/file/memory_stream.h index 728f0b1cb5..94bbfc39e1 100644 --- a/libretro-common/include/file/memory_stream.h +++ b/libretro-common/include/file/memory_stream.h @@ -23,8 +23,8 @@ #ifndef _LIBRETRO_SDK_FILE_MEMORY_STREAM_H #define _LIBRETRO_SDK_FILE_MEMORY_STREAM_H -#include #include +#include typedef struct memstream memstream_t; diff --git a/rewind.c b/rewind.c index 6cc28bd5b7..8d26730cd6 100644 --- a/rewind.c +++ b/rewind.c @@ -16,6 +16,7 @@ */ #define __STDC_LIMIT_MACROS +#include #include #include @@ -26,12 +27,12 @@ #include "rewind.h" #include "performance.h" -#ifndef UINT16_MAX -#define UINT16_MAX 0xffff +#ifndef UINT_FAST16_MAX +#define UINT_FAST16_MAX 0xffff #endif -#ifndef UINT32_MAX -#define UINT32_MAX 0xffffffffu +#ifndef UINT_LEAST32_MAX +#define UINT_LEAST32_MAX 0xffffffffu #endif #undef CPU_X86 @@ -67,7 +68,7 @@ size thisstart; size_t state_manager_raw_maxsize(size_t uncomp) { /* bytes covered by a compressed block */ - const int maxcblkcover = UINT16_MAX * sizeof(uint16_t); + const int maxcblkcover = UINT_FAST16_MAX * sizeof(uint16_t); /* uncompressed size, rounded to 16 bits */ size_t uncomp16 = (uncomp + sizeof(uint16_t) - 1) & ~sizeof(uint16_t); /* number of blocks */ @@ -245,15 +246,13 @@ size_t state_manager_raw_compress(const void *src, new16 += skip; num16s -= skip; - if (skip > UINT16_MAX) + if (skip > UINT_FAST16_MAX) { - if (skip > UINT32_MAX) - { - /* This will make it scan the entire thing again, - * but it only hits on 8GB unchanged data anyways, - * and if you're doing that, you've got bigger problems. */ - skip = UINT32_MAX; - } + /* This will make it scan the entire thing again, + * but it only hits on 8GB unchanged data anyways, + * and if you're doing that, you've got bigger problems. */ + if (skip > UINT_LEAST32_MAX) + skip = UINT_LEAST32_MAX; *compressed16++ = 0; *compressed16++ = skip; *compressed16++ = skip >> 16; @@ -262,8 +261,8 @@ size_t state_manager_raw_compress(const void *src, } changed = find_same(old16, new16); - if (changed > UINT16_MAX) - changed = UINT16_MAX; + if (changed > UINT_FAST16_MAX) + changed = UINT_FAST16_MAX; *compressed16++ = changed; *compressed16++ = skip;