diff options
author | Twinaphex | 2017-01-29 06:00:06 +0100 |
---|---|---|
committer | GitHub | 2017-01-29 06:00:06 +0100 |
commit | b9ad67f2d3f5bc1f7ebaad2eeb225d669aa7f58b (patch) | |
tree | adce7b06d1acc25f52c6e10616451bba02f9f7a5 /source/blargg_endian.h | |
parent | 813fc89d37d1d8c8d2fa090a28f74aa0fdcea5df (diff) | |
parent | 0e59b999fa976de2d00490f552a1ff0a27d40f63 (diff) | |
download | snes9x2005-b9ad67f2d3f5bc1f7ebaad2eeb225d669aa7f58b.tar.gz snes9x2005-b9ad67f2d3f5bc1f7ebaad2eeb225d669aa7f58b.tar.bz2 snes9x2005-b9ad67f2d3f5bc1f7ebaad2eeb225d669aa7f58b.zip |
Merge pull request #30 from jamsilva/master
Converted most types to stdint-style (fixing a few in the process).
Diffstat (limited to 'source/blargg_endian.h')
-rw-r--r-- | source/blargg_endian.h | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/source/blargg_endian.h b/source/blargg_endian.h index 80ce61e..3fc7296 100644 --- a/source/blargg_endian.h +++ b/source/blargg_endian.h @@ -19,12 +19,6 @@ #include <boolean.h> -#if UINT_MAX < 0xFFFFFFFF || ULONG_MAX == 0xFFFFFFFF - typedef unsigned long blargg_ulong; -#else - typedef unsigned blargg_ulong; -#endif - #include <stdint.h> /* BLARGG_CPU_CISC: Defined if CPU has very few general-purpose registers (< 16) */ @@ -75,31 +69,31 @@ #define SET_LE32( addr, data ) (void) (*(uint32_t*) (addr) = (data)) #endif #else -static INLINE unsigned get_le16( void const* p ) +static INLINE uint32_t get_le16( void const* p ) { - return (unsigned) ((unsigned char const*) p) [1] << 8 | (unsigned) ((unsigned char const*) p) [0]; + return (uint32_t) ((uint8_t const*) p) [1] << 8 | (uint32_t) ((uint8_t const*) p) [0]; } -static INLINE blargg_ulong get_le32( void const* p ) +static INLINE uint32_t get_le32( void const* p ) { - return (blargg_ulong) ((unsigned char const*) p) [3] << 24 | - (blargg_ulong) ((unsigned char const*) p) [2] << 16 | - (blargg_ulong) ((unsigned char const*) p) [1] << 8 | - (blargg_ulong) ((unsigned char const*) p) [0]; + return (uint32_t) ((uint8_t const*) p) [3] << 24 | + (uint32_t) ((uint8_t const*) p) [2] << 16 | + (uint32_t) ((uint8_t const*) p) [1] << 8 | + (uint32_t) ((uint8_t const*) p) [0]; } -static INLINE void set_le16( void* p, unsigned n ) +static INLINE void set_le16( void* p, uint32_t n ) { - ((unsigned char*) p) [1] = (unsigned char) (n >> 8); - ((unsigned char*) p) [0] = (unsigned char) n; + ((uint8_t*) p) [1] = (uint8_t) (n >> 8); + ((uint8_t*) p) [0] = (uint8_t) n; } -static INLINE void set_le32( void* p, blargg_ulong n ) +static INLINE void set_le32( void* p, uint32_t n ) { - ((unsigned char*) p) [0] = (unsigned char) n; - ((unsigned char*) p) [1] = (unsigned char) (n >> 8); - ((unsigned char*) p) [2] = (unsigned char) (n >> 16); - ((unsigned char*) p) [3] = (unsigned char) (n >> 24); + ((uint8_t*) p) [0] = (uint8_t) n; + ((uint8_t*) p) [1] = (uint8_t) (n >> 8); + ((uint8_t*) p) [2] = (uint8_t) (n >> 16); + ((uint8_t*) p) [3] = (uint8_t) (n >> 24); } #endif |