mirror of
https://github.com/libretro/RetroArch
synced 2025-03-26 02:37:23 +00:00
Use UINT_FAST16_MAX/UINT_LEAST32_MAX
This commit is contained in:
parent
b6207b9b76
commit
872314f910
@ -28,11 +28,12 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <boolean.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include <boolean.h>
|
||||||
|
|
||||||
struct config_entry_list
|
struct config_entry_list
|
||||||
{
|
{
|
||||||
/* If we got this from an #include,
|
/* If we got this from an #include,
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#define _LIBRETRO_SDK_CONFIG_FILE_USERDATA_H
|
#define _LIBRETRO_SDK_CONFIG_FILE_USERDATA_H
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "config_file.h"
|
#include "config_file.h"
|
||||||
|
|
||||||
struct config_file_userdata
|
struct config_file_userdata
|
||||||
|
@ -23,9 +23,10 @@
|
|||||||
#ifndef FILE_EXTRACT_H__
|
#ifndef FILE_EXTRACT_H__
|
||||||
#define FILE_EXTRACT_H__
|
#define FILE_EXTRACT_H__
|
||||||
|
|
||||||
#include <boolean.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include <boolean.h>
|
||||||
|
|
||||||
typedef struct zlib_handle
|
typedef struct zlib_handle
|
||||||
{
|
{
|
||||||
|
@ -23,12 +23,12 @@
|
|||||||
#ifndef __LIBRETRO_SDK_FILE_PATH_H
|
#ifndef __LIBRETRO_SDK_FILE_PATH_H
|
||||||
#define __LIBRETRO_SDK_FILE_PATH_H
|
#define __LIBRETRO_SDK_FILE_PATH_H
|
||||||
|
|
||||||
#include <boolean.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#include <boolean.h>
|
||||||
#include <retro_inline.h>
|
#include <retro_inline.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
#ifndef _LIBRETRO_SDK_FILE_MEMORY_STREAM_H
|
#ifndef _LIBRETRO_SDK_FILE_MEMORY_STREAM_H
|
||||||
#define _LIBRETRO_SDK_FILE_MEMORY_STREAM_H
|
#define _LIBRETRO_SDK_FILE_MEMORY_STREAM_H
|
||||||
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
typedef struct memstream memstream_t;
|
typedef struct memstream memstream_t;
|
||||||
|
|
||||||
|
29
rewind.c
29
rewind.c
@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define __STDC_LIMIT_MACROS
|
#define __STDC_LIMIT_MACROS
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -26,12 +27,12 @@
|
|||||||
#include "rewind.h"
|
#include "rewind.h"
|
||||||
#include "performance.h"
|
#include "performance.h"
|
||||||
|
|
||||||
#ifndef UINT16_MAX
|
#ifndef UINT_FAST16_MAX
|
||||||
#define UINT16_MAX 0xffff
|
#define UINT_FAST16_MAX 0xffff
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef UINT32_MAX
|
#ifndef UINT_LEAST32_MAX
|
||||||
#define UINT32_MAX 0xffffffffu
|
#define UINT_LEAST32_MAX 0xffffffffu
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef CPU_X86
|
#undef CPU_X86
|
||||||
@ -67,7 +68,7 @@ size thisstart;
|
|||||||
size_t state_manager_raw_maxsize(size_t uncomp)
|
size_t state_manager_raw_maxsize(size_t uncomp)
|
||||||
{
|
{
|
||||||
/* bytes covered by a compressed block */
|
/* 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 */
|
/* uncompressed size, rounded to 16 bits */
|
||||||
size_t uncomp16 = (uncomp + sizeof(uint16_t) - 1) & ~sizeof(uint16_t);
|
size_t uncomp16 = (uncomp + sizeof(uint16_t) - 1) & ~sizeof(uint16_t);
|
||||||
/* number of blocks */
|
/* number of blocks */
|
||||||
@ -245,15 +246,13 @@ size_t state_manager_raw_compress(const void *src,
|
|||||||
new16 += skip;
|
new16 += skip;
|
||||||
num16s -= 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,
|
||||||
/* This will make it scan the entire thing again,
|
* and if you're doing that, you've got bigger problems. */
|
||||||
* but it only hits on 8GB unchanged data anyways,
|
if (skip > UINT_LEAST32_MAX)
|
||||||
* and if you're doing that, you've got bigger problems. */
|
skip = UINT_LEAST32_MAX;
|
||||||
skip = UINT32_MAX;
|
|
||||||
}
|
|
||||||
*compressed16++ = 0;
|
*compressed16++ = 0;
|
||||||
*compressed16++ = skip;
|
*compressed16++ = skip;
|
||||||
*compressed16++ = skip >> 16;
|
*compressed16++ = skip >> 16;
|
||||||
@ -262,8 +261,8 @@ size_t state_manager_raw_compress(const void *src,
|
|||||||
}
|
}
|
||||||
|
|
||||||
changed = find_same(old16, new16);
|
changed = find_same(old16, new16);
|
||||||
if (changed > UINT16_MAX)
|
if (changed > UINT_FAST16_MAX)
|
||||||
changed = UINT16_MAX;
|
changed = UINT_FAST16_MAX;
|
||||||
|
|
||||||
*compressed16++ = changed;
|
*compressed16++ = changed;
|
||||||
*compressed16++ = skip;
|
*compressed16++ = skip;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user