From 25a18c3b42424e66e81480f37b3d3f021ffd2910 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 22 Oct 2014 01:00:59 +0200 Subject: [PATCH] Add retro_inline.h to SDK --- libretro-sdk/include/retro_endianness.h | 15 ++++---- libretro-sdk/include/retro_inline.h | 40 ++++++++++++++++++++++ libretro-sdk/include/retro_miscellaneous.h | 7 ++-- 3 files changed, 52 insertions(+), 10 deletions(-) create mode 100644 libretro-sdk/include/retro_inline.h diff --git a/libretro-sdk/include/retro_endianness.h b/libretro-sdk/include/retro_endianness.h index 881516f552..a161ac0d62 100644 --- a/libretro-sdk/include/retro_endianness.h +++ b/libretro-sdk/include/retro_endianness.h @@ -23,6 +23,7 @@ #ifndef __LIBRETRO_SDK_ENDIANNESS_H #define __LIBRETRO_SDK_ENDIANNESS_H +#include #include #define SWAP32(x) ((uint32_t)( \ @@ -32,7 +33,7 @@ (((uint32_t)(x) & 0xff000000) >> 24) \ )) -static inline uint8_t is_little_endian(void) +static INLINE uint8_t is_little_endian(void) { union { @@ -44,7 +45,7 @@ static inline uint8_t is_little_endian(void) return u.y[0]; } -static inline uint32_t swap_if_big32(uint32_t val) +static INLINE uint32_t swap_if_big32(uint32_t val) { if (is_little_endian()) return val; @@ -52,7 +53,7 @@ static inline uint32_t swap_if_big32(uint32_t val) ((val << 8) & 0xFF0000) | (val << 24); } -static inline uint32_t swap_if_little32(uint32_t val) +static INLINE uint32_t swap_if_little32(uint32_t val) { if (is_little_endian()) return (val >> 24) | ((val >> 8) & 0xFF00) | @@ -60,26 +61,26 @@ static inline uint32_t swap_if_little32(uint32_t val) return val; } -static inline uint16_t swap_if_big16(uint16_t val) +static INLINE uint16_t swap_if_big16(uint16_t val) { if (is_little_endian()) return val; return (val >> 8) | (val << 8); } -static inline uint16_t swap_if_little16(uint16_t val) +static INLINE uint16_t swap_if_little16(uint16_t val) { if (is_little_endian()) return (val >> 8) | (val << 8); return val; } -static inline void store32be(uint32_t *addr, uint32_t data) +static INLINE void store32be(uint32_t *addr, uint32_t data) { *addr = is_little_endian() ? SWAP32(data) : data; } -static inline uint32_t load32be(const uint32_t *addr) +static INLINE uint32_t load32be(const uint32_t *addr) { return is_little_endian() ? SWAP32(*addr) : *addr; } diff --git a/libretro-sdk/include/retro_inline.h b/libretro-sdk/include/retro_inline.h new file mode 100644 index 0000000000..2639148f7e --- /dev/null +++ b/libretro-sdk/include/retro_inline.h @@ -0,0 +1,40 @@ +/* Copyright (C) 2010-2014 The RetroArch team + * + * --------------------------------------------------------------------------------------- + * The following license statement only applies to this file (retro_inline.h). + * --------------------------------------------------------------------------------------- + * + * Permission is hereby granted, free of charge, + * to any person obtaining a copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, + * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, + * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef __LIBRETRO_SDK_INLINE_H_ +#define __LIBRETRO_SDK_INLINE_H + +#if !defined(__cplusplus) && defined(_WIN32) + +#ifndef INLINE +#define INLINE _inline +#endif + +#else + +#ifndef INLINE +#define INLINE inline +#endif + +#endif + +#endif diff --git a/libretro-sdk/include/retro_miscellaneous.h b/libretro-sdk/include/retro_miscellaneous.h index c6450f8685..4ab2c71420 100644 --- a/libretro-sdk/include/retro_miscellaneous.h +++ b/libretro-sdk/include/retro_miscellaneous.h @@ -47,6 +47,7 @@ /* TODO/FIXME - dirty hack */ #include "../../retroarch_logger.h" #endif +#include #include #include @@ -75,7 +76,7 @@ #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) #define RARCH_SCALE_BASE 256 -static inline void rarch_sleep(unsigned msec) +static INLINE void rarch_sleep(unsigned msec) { #if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__) sys_timer_usleep(1000 * msec); @@ -95,7 +96,7 @@ static inline void rarch_sleep(unsigned msec) #endif } -static inline uint32_t next_pow2(uint32_t v) +static INLINE uint32_t next_pow2(uint32_t v) { v--; v |= v >> 1; @@ -107,7 +108,7 @@ static inline uint32_t next_pow2(uint32_t v) return v; } -static inline uint32_t prev_pow2(uint32_t v) +static INLINE uint32_t prev_pow2(uint32_t v) { v |= v >> 1; v |= v >> 2;