Simplify integer type aliases

Always alias them from cstdint, as all compilers should support them.
This commit is contained in:
Link Mauve 2025-06-24 00:50:49 +02:00
parent 56a8801575
commit ecd4c1642c
5 changed files with 15 additions and 43 deletions

View File

@ -181,7 +181,7 @@ void MovieRecord::dump(EMUFILE &fp)
//dump the misc commands //dump the misc commands
//*os << '|' << setw(1) << (int)commands; //*os << '|' << setw(1) << (int)commands;
fp.fputc('|'); fp.fputc('|');
putdec<uint8,1,true>(fp,commands); putdec<u8,1,true>(fp,commands);
fp.fputc('|'); fp.fputc('|');
dumpPad(fp, pad); dumpPad(fp, pad);
@ -944,7 +944,7 @@ void FCEUI_SaveMovie(const char *fname, std::wstring author, START_FROM startFro
// osd->addFixed(180, 176, "%s", "Recording"); // osd->addFixed(180, 176, "%s", "Recording");
} }
/*extern uint8 joy[4]; /*extern u8 joy[4];
memcpy(&cur_input_display,joy,4);*/ memcpy(&cur_input_display,joy,4);*/
} }

View File

@ -1344,7 +1344,7 @@ bool savestate_load(EMUFILE &is)
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
uLongf uncomprlen = len; uLongf uncomprlen = len;
int error = uncompress((uint8*)&buf[0],&uncomprlen,(uint8*)&cbuf[0],comprlen); int error = uncompress((u8*)&buf[0],&uncomprlen,(u8*)&cbuf[0],comprlen);
if (error != Z_OK || uncomprlen != len) if (error != Z_OK || uncomprlen != len)
return false; return false;
#endif #endif

View File

@ -19,6 +19,7 @@
#ifndef TYPES_HPP #ifndef TYPES_HPP
#define TYPES_HPP #define TYPES_HPP
#include <cstdint>
#include <retro_miscellaneous.h> #include <retro_miscellaneous.h>
#include <retro_inline.h> #include <retro_inline.h>
#include <math/fxp.h> #include <math/fxp.h>
@ -229,44 +230,15 @@
#endif #endif
#endif #endif
#if defined(__LP64__) typedef uint8_t u8;
typedef unsigned char u8; typedef uint16_t u16;
typedef unsigned short u16; typedef uint32_t u32;
typedef unsigned int u32; typedef uint64_t u64;
typedef unsigned long long u64;
typedef signed char s8; typedef int8_t s8;
typedef signed short s16; typedef int16_t s16;
typedef signed int s32; typedef int32_t s32;
typedef signed long long s64; typedef int64_t s64;
#else
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
typedef unsigned __int64 u64;
#else
typedef unsigned long long u64;
#endif
typedef signed char s8;
typedef signed short s16;
typedef signed int s32;
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
typedef __int64 s64;
#else
typedef signed long long s64;
#endif
#endif
typedef u8 uint8;
typedef u16 uint16;
#ifndef OBJ_C
typedef u32 uint32;
#else
#define uint32 u32 //uint32 is defined in Leopard somewhere, avoid conflicts
#endif
#ifdef ENABLE_ALTIVEC #ifdef ENABLE_ALTIVEC
#ifndef __APPLE_ALTIVEC__ #ifndef __APPLE_ALTIVEC__
@ -378,7 +350,7 @@ typedef __m512 v512f32;
typedef s32 f32; typedef s32 f32;
#define inttof32(n) ((n) << 12) #define inttof32(n) ((n) << 12)
#define f32toint(n) ((n) >> 12) #define f32toint(n) ((n) >> 12)
#define floattof32(n) ((int32)((n) * (1 << 12))) #define floattof32(n) ((s32)((n) * (1 << 12)))
#define f32tofloat(n) (((float)(n)) / (float)(1<<12)) #define f32tofloat(n) (((float)(n)) / (float)(1<<12))
typedef s16 t16; typedef s16 t16;

View File

@ -68,7 +68,7 @@ Desmume_Guid Desmume_Guid::fromString(std::string str)
return ret; return ret;
} }
uint8 Desmume_Guid::hexToByte(char** ptrptr) u8 Desmume_Guid::hexToByte(char** ptrptr)
{ {
char a = toupper(**ptrptr); char a = toupper(**ptrptr);
(*ptrptr)++; (*ptrptr)++;

View File

@ -43,7 +43,7 @@ struct Desmume_Guid : public ValueArray<u8,16>
void newGuid(); void newGuid();
std::string toString(); std::string toString();
static Desmume_Guid fromString(std::string str); static Desmume_Guid fromString(std::string str);
static uint8 hexToByte(char** ptrptr); static u8 hexToByte(char** ptrptr);
void scan(std::string& str); void scan(std::string& str);
}; };