Use retro_inline throughout

This commit is contained in:
twinaphex 2015-03-15 04:52:46 +01:00
parent 08f59ddbff
commit 84e9f2fa7d
19 changed files with 74 additions and 46 deletions

View File

@ -20,6 +20,8 @@
#ifndef XAUDIO2_STRIPPED_H #ifndef XAUDIO2_STRIPPED_H
#define XAUDIO2_STRIPPED_H #define XAUDIO2_STRIPPED_H
#include <retro_inline.h>
// All structures defined in this file use tight field packing // All structures defined in this file use tight field packing
#pragma pack(push, 1) #pragma pack(push, 1)
#define X2DEFAULT(x) = (x) #define X2DEFAULT(x) = (x)
@ -254,7 +256,7 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown)
STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0), STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0),
XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)); XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR));
#else #else
static inline HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32, XAUDIO2_PROCESSOR) static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32, XAUDIO2_PROCESSOR)
{ {
IXAudio2 *pXAudio2; IXAudio2 *pXAudio2;

View File

@ -24,6 +24,7 @@
#include "platform_android.h" #include "platform_android.h"
#include "../../general.h" #include "../../general.h"
#include <retro_inline.h>
struct android_app *g_android; struct android_app *g_android;
static pthread_key_t thread_key; static pthread_key_t thread_key;
@ -153,7 +154,7 @@ void engine_handle_cmd(void *data)
} }
} }
static inline void android_app_write_cmd(void *data, int8_t cmd) static INLINE void android_app_write_cmd(void *data, int8_t cmd)
{ {
struct android_app *android_app = (struct android_app*)data; struct android_app *android_app = (struct android_app*)data;

View File

@ -1,3 +1,5 @@
#include <retro_inline.h>
#define STRUCT_REGDEF_SIZE 1440 #define STRUCT_REGDEF_SIZE 1440
#define WGPIPE (0xCC008000) #define WGPIPE (0xCC008000)
@ -357,7 +359,7 @@ static void __SETVCDATTR(struct __gx_regdef *__gx, u8 attr,u8 type)
FIFO_PUTU16(vtxcnt) FIFO_PUTU16(vtxcnt)
#ifdef HW_DOL #ifdef HW_DOL
static inline void __GX_UpdateBPMask(struct __gx_regdef *__gx) static INLINE void __GX_UpdateBPMask(struct __gx_regdef *__gx)
{ {
u32 i, nbmp, nres; u32 i, nbmp, nres;
u8 ntexmap; u8 ntexmap;
@ -414,7 +416,7 @@ static inline void __GX_UpdateBPMask(struct __gx_regdef *__gx)
GX_LOAD_XF_REG(0x100d,__gx->chnMatColor[1]); \ GX_LOAD_XF_REG(0x100d,__gx->chnMatColor[1]); \
} }
static inline void __GX_SetTexCoordGen(struct __gx_regdef *__gx) static INLINE void __GX_SetTexCoordGen(struct __gx_regdef *__gx)
{ {
u32 i,mask; u32 i,mask;
u32 texcoord; u32 texcoord;
@ -459,7 +461,7 @@ static void __SetSURegs(struct __gx_regdef *__gx, u8 texmap,u8 texcoord)
GX_LOAD_BP_REG(__gx->suTsize[reg]); GX_LOAD_BP_REG(__gx->suTsize[reg]);
} }
static inline void __GX_SetSUTexRegs(struct __gx_regdef *__gx) static INLINE void __GX_SetSUTexRegs(struct __gx_regdef *__gx)
{ {
u32 i, indtev, dirtev, tevreg, tevm, texcm; u32 i, indtev, dirtev, tevreg, tevm, texcm;
u8 texcoord, texmap; u8 texcoord, texmap;
@ -747,7 +749,7 @@ static void __GX_SendFlushPrim(struct __gx_regdef *__gx)
#define Y_FACTOR 342.0 #define Y_FACTOR 342.0
#define ZFACTOR 16777215.0 #define ZFACTOR 16777215.0
static inline void __GX_SetViewportJitter(f32 xOrig,f32 yOrig,f32 wd,f32 ht,f32 nearZ,f32 farZ,u32 field) static INLINE void __GX_SetViewportJitter(f32 xOrig,f32 yOrig,f32 wd,f32 ht,f32 nearZ,f32 farZ,u32 field)
{ {
f32 x0,y0,x1,y1,n,f,z; f32 x0,y0,x1,y1,n,f,z;
static f32 Xfactor = 0.5; static f32 Xfactor = 0.5;

View File

@ -24,6 +24,7 @@
#include "font_gl_driver.h" #include "font_gl_driver.h"
#include <formats/image.h> #include <formats/image.h>
#include "video_shader_driver.h" #include "video_shader_driver.h"
#include <retro_inline.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "../config.h" #include "../config.h"
@ -361,7 +362,7 @@ typedef struct gl
GLuint vao; GLuint vao;
} gl_t; } gl_t;
static inline bool gl_check_error(void) static INLINE bool gl_check_error(void)
{ {
int error = glGetError(); int error = glGetError();
switch (error) switch (error)

6
hash.h
View File

@ -48,6 +48,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include <retro_inline.h>
/** /**
* sha256_hash: * sha256_hash:
* @out : Output. * @out : Output.
@ -61,12 +63,12 @@ void sha256_hash(char *out, const uint8_t *in, size_t size);
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
#include <zlib.h> #include <zlib.h>
static inline uint32_t crc32_calculate(const uint8_t *data, size_t length) static INLINE uint32_t crc32_calculate(const uint8_t *data, size_t length)
{ {
return crc32(0, data, length); return crc32(0, data, length);
} }
static inline uint32_t crc32_adjust(uint32_t crc, uint8_t data) static INLINE uint32_t crc32_adjust(uint32_t crc, uint8_t data)
{ {
/* zlib and nall have different /* zlib and nall have different
* assumptions on "sign" for this function. */ * assumptions on "sign" for this function. */

View File

@ -27,6 +27,8 @@
#include "../../general.h" #include "../../general.h"
#include "../../driver.h" #include "../../driver.h"
#include <retro_inline.h>
#define MAX_TOUCH 16 #define MAX_TOUCH 16
#define MAX_PADS 8 #define MAX_PADS 8
@ -325,7 +327,7 @@ static void *android_input_init(void)
static int zeus_id = -1; static int zeus_id = -1;
static int zeus_second_id = -1; static int zeus_second_id = -1;
static inline int android_input_poll_event_type_motion( static INLINE int android_input_poll_event_type_motion(
android_input_t *android, AInputEvent *event, android_input_t *android, AInputEvent *event,
int port, int source) int port, int source)
{ {
@ -379,7 +381,7 @@ static inline int android_input_poll_event_type_motion(
return 0; return 0;
} }
static inline void android_input_poll_event_type_key( static INLINE void android_input_poll_event_type_key(
android_input_t *android, struct android_app *android_app, android_input_t *android, struct android_app *android_app,
AInputEvent *event, int port, int keycode, int source, AInputEvent *event, int port, int keycode, int source,
int type_event, int *handled) int type_event, int *handled)

View File

@ -3,6 +3,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <retro_inline.h>
static uint8_t ATTRIBUTE_ALIGN(32) _ss_attributes_payload[] = static uint8_t ATTRIBUTE_ALIGN(32) _ss_attributes_payload[] =
{ {
0x52, 0x52,
@ -181,13 +183,13 @@ static int _ss_send_attributes_payload(struct ss_device *dev)
NULL, NULL); NULL, NULL);
} }
inline int ss_set_led(struct ss_device *dev, int led) static INLINE int ss_set_led(struct ss_device *dev, int led)
{ {
dev->attributes.led = led; dev->attributes.led = led;
return _ss_send_attributes_payload(dev); return _ss_send_attributes_payload(dev);
} }
inline int ss_set_rumble(struct ss_device *dev, uint8_t duration_right, static INLINE int ss_set_rumble(struct ss_device *dev, uint8_t duration_right,
uint8_t power_right, uint8_t duration_left, uint8_t power_left) uint8_t power_right, uint8_t duration_left, uint8_t power_left)
{ {
dev->attributes.rumble.duration_right = duration_right; dev->attributes.rumble.duration_right = duration_right;

View File

@ -16,6 +16,8 @@
#include "../input_autodetect.h" #include "../input_autodetect.h"
#include <retro_inline.h>
static uint64_t pad_state[MAX_PADS]; static uint64_t pad_state[MAX_PADS];
static int16_t analog_state[MAX_PADS][2][2]; static int16_t analog_state[MAX_PADS][2][2];
static unsigned pads_connected; static unsigned pads_connected;
@ -23,7 +25,7 @@ static unsigned pads_connected;
sensor_t accelerometer_state[MAX_PADS]; sensor_t accelerometer_state[MAX_PADS];
#endif #endif
static inline int16_t convert_u8_to_s16(uint8_t val) static INLINE int16_t convert_u8_to_s16(uint8_t val)
{ {
if (val == 0) if (val == 0)
return -0x7fff; return -0x7fff;

View File

@ -30,6 +30,8 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/input.h> #include <linux/input.h>
#include <retro_inline.h>
/* Udev/evdev Linux joypad driver. /* Udev/evdev Linux joypad driver.
* More complex and extremely low level, * More complex and extremely low level,
* but only Linux driver which can support joypad rumble. * but only Linux driver which can support joypad rumble.
@ -74,7 +76,7 @@ static struct udev *g_udev;
static struct udev_monitor *g_udev_mon; static struct udev_monitor *g_udev_mon;
static struct udev_joypad udev_pads[MAX_USERS]; static struct udev_joypad udev_pads[MAX_USERS];
static inline int16_t compute_axis(const struct input_absinfo *info, int value) static INLINE int16_t compute_axis(const struct input_absinfo *info, int value)
{ {
int range = info->maximum - info->minimum; int range = info->maximum - info->minimum;
int axis = (value - info->minimum) * 0xffffll / range - 0x7fffll; int axis = (value - info->minimum) * 0xffffll / range - 0x7fffll;

View File

@ -30,6 +30,8 @@
#include <stddef.h> #include <stddef.h>
#include <string.h> #include <string.h>
#include <retro_inline.h>
/* Check if the definitions do not already exist. /* Check if the definitions do not already exist.
* Official and mingw xinput headers have different include guards. * Official and mingw xinput headers have different include guards.
*/ */
@ -120,7 +122,7 @@ static XINPUT_VIBRATION g_xinput_rumble_states[4];
static winxinput_joypad_state g_winxinput_states[4]; static winxinput_joypad_state g_winxinput_states[4];
static inline int pad_index_to_xuser_index(unsigned pad) static INLINE int pad_index_to_xuser_index(unsigned pad)
{ {
return g_xinput_pad_indexes[pad]; return g_xinput_pad_indexes[pad];
} }

View File

@ -23,6 +23,7 @@ extern "C" {
#include <stdint.h> #include <stdint.h>
#include "../driver.h" #include "../driver.h"
#include <retro_inline.h>
/** /**
* input_conv_analog_id_to_bind_id: * input_conv_analog_id_to_bind_id:
@ -40,7 +41,7 @@ extern "C" {
* Takes as input analog key identifiers and converts * Takes as input analog key identifiers and converts
* them to corresponding bind IDs @ident_minus and @ident_plus. * them to corresponding bind IDs @ident_minus and @ident_plus.
**/ **/
static inline void input_conv_analog_id_to_bind_id(unsigned idx, unsigned ident, static INLINE void input_conv_analog_id_to_bind_id(unsigned idx, unsigned ident,
unsigned *ident_minus, unsigned *ident_plus) unsigned *ident_minus, unsigned *ident_plus)
{ {
switch ((idx << 1) | ident) switch ((idx << 1) | ident)

View File

@ -26,8 +26,9 @@
#include "../driver.h" #include "../driver.h"
#include "keyboard_line.h" #include "keyboard_line.h"
#include "input_keymaps.h" #include "input_keymaps.h"
#include <retro_inline.h>
static inline unsigned leading_ones(uint8_t c) static INLINE unsigned leading_ones(uint8_t c)
{ {
unsigned ones = 0; unsigned ones = 0;
while (c & 0x80) while (c & 0x80)

View File

@ -26,8 +26,9 @@
#endif #endif
#include <stdarg.h> #include <stdarg.h>
#include <retro_inline.h>
static inline void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap) static INLINE void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
{ {
#if TARGET_IPHONE_SIMULATOR #if TARGET_IPHONE_SIMULATOR
vprintf(fmt, ap); vprintf(fmt, ap);
@ -41,7 +42,7 @@ static inline void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
#endif #endif
} }
static inline void RARCH_LOG(const char *fmt, ...) static INLINE void RARCH_LOG(const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
@ -49,13 +50,13 @@ static inline void RARCH_LOG(const char *fmt, ...)
va_end(ap); va_end(ap);
} }
static inline void RARCH_LOG_OUTPUT_V(const char *tag, static INLINE void RARCH_LOG_OUTPUT_V(const char *tag,
const char *fmt, va_list ap) const char *fmt, va_list ap)
{ {
RARCH_LOG_V(tag, fmt, ap); RARCH_LOG_V(tag, fmt, ap);
} }
static inline void RARCH_LOG_OUTPUT(const char *fmt, ...) static INLINE void RARCH_LOG_OUTPUT(const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
@ -63,12 +64,12 @@ static inline void RARCH_LOG_OUTPUT(const char *fmt, ...)
va_end(ap); va_end(ap);
} }
static inline void RARCH_WARN_V(const char *tag, const char *fmt, va_list ap) static INLINE void RARCH_WARN_V(const char *tag, const char *fmt, va_list ap)
{ {
RARCH_LOG_V(tag, fmt, ap); RARCH_LOG_V(tag, fmt, ap);
} }
static inline void RARCH_WARN(const char *fmt, ...) static INLINE void RARCH_WARN(const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
@ -76,12 +77,12 @@ static inline void RARCH_WARN(const char *fmt, ...)
va_end(ap); va_end(ap);
} }
static inline void RARCH_ERR_V(const char *tag, const char *fmt, va_list ap) static INLINE void RARCH_ERR_V(const char *tag, const char *fmt, va_list ap)
{ {
RARCH_LOG_V(tag, fmt, ap); RARCH_LOG_V(tag, fmt, ap);
} }
static inline void RARCH_ERR(const char *fmt, ...) static INLINE void RARCH_ERR(const char *fmt, ...)
{ {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);

View File

@ -14,6 +14,7 @@
*/ */
#include <file/file_path.h> #include <file/file_path.h>
#include <retro_inline.h>
#include "menu.h" #include "menu.h"
#include "menu_entries_cbs.h" #include "menu_entries_cbs.h"
#include "menu_setting.h" #include "menu_setting.h"
@ -140,7 +141,7 @@ static int load_or_open_zip_iterate(unsigned action)
return 0; return 0;
} }
static inline struct video_shader *shader_manager_get_current_shader(const char *label, unsigned type) static INLINE struct video_shader *shader_manager_get_current_shader(const char *label, unsigned type)
{ {
menu_handle_t *menu = menu_driver_resolve(); menu_handle_t *menu = menu_driver_resolve();
if (!menu) if (!menu)

View File

@ -20,6 +20,7 @@
#include "menu_navigation.h" #include "menu_navigation.h"
#include "menu_entries.h" #include "menu_entries.h"
#include <string.h> #include <string.h>
#include <retro_inline.h>
/** /**
* Before a refresh, we could have deleted a * Before a refresh, we could have deleted a
@ -53,7 +54,7 @@ static void menu_entries_refresh(file_list_t *list)
* *
* Returns: true (1) if entry is a directory, otherwise false (0). * Returns: true (1) if entry is a directory, otherwise false (0).
**/ **/
static inline bool menu_entries_list_elem_is_dir(file_list_t *list, static INLINE bool menu_entries_list_elem_is_dir(file_list_t *list,
unsigned offset) unsigned offset)
{ {
const char *path = NULL; const char *path = NULL;
@ -75,7 +76,7 @@ static inline bool menu_entries_list_elem_is_dir(file_list_t *list,
* *
* Returns: first character of element in file list. * Returns: first character of element in file list.
**/ **/
static inline int menu_entries_list_get_first_char( static INLINE int menu_entries_list_get_first_char(
file_list_t *list, unsigned offset) file_list_t *list, unsigned offset)
{ {
int ret; int ret;

View File

@ -56,6 +56,8 @@
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
#include <retro_inline.h>
static pthread_once_t g_once; static pthread_once_t g_once;
static AndroidCpuFamily g_cpuFamily; static AndroidCpuFamily g_cpuFamily;
static uint64_t g_cpuFeatures; static uint64_t g_cpuFeatures;
@ -70,7 +72,7 @@ static int g_cpuCount;
#endif #endif
#ifdef __i386__ #ifdef __i386__
static __inline__ void cpu_x86_cpuid(int func, int values[4]) static INLINE void cpu_x86_cpuid(int func, int values[4])
{ {
int a, b, c, d; int a, b, c, d;
/* We need to preserve ebx since we're compiling PIC code */ /* We need to preserve ebx since we're compiling PIC code */

View File

@ -10,34 +10,35 @@
#include <malloc.h> #include <malloc.h>
#include <unistd.h> #include <unistd.h>
#include "mem2_manager.h" #include "mem2_manager.h"
#include <retro_inline.h>
// Forbid the use of MEM2 through malloc // Forbid the use of MEM2 through malloc
u32 MALLOC_MEM2 = 0; u32 MALLOC_MEM2 = 0;
/*** from libogc (lwp_heap.inl) ****/ /*** from libogc (lwp_heap.inl) ****/
static inline heap_block *__lwp_heap_blockat(heap_block *block, u32 offset) static INLINE heap_block *__lwp_heap_blockat(heap_block *block, u32 offset)
{ {
return (heap_block *) ((char *) block + offset); return (heap_block *) ((char *) block + offset);
} }
static inline heap_block *__lwp_heap_usrblockat(void *ptr) static INLINE heap_block *__lwp_heap_usrblockat(void *ptr)
{ {
u32 offset = *(((u32 *) ptr) - 1); u32 offset = *(((u32 *) ptr) - 1);
return __lwp_heap_blockat(ptr, -offset + -HEAP_BLOCK_USED_OVERHEAD); return __lwp_heap_blockat(ptr, -offset + -HEAP_BLOCK_USED_OVERHEAD);
} }
static inline bool __lwp_heap_blockin(heap_cntrl *heap, heap_block *block) static INLINE bool __lwp_heap_blockin(heap_cntrl *heap, heap_block *block)
{ {
return ((u32) block >= (u32) heap->start && (u32) block <= (u32) heap->final); return ((u32) block >= (u32) heap->start && (u32) block <= (u32) heap->final);
} }
static inline bool __lwp_heap_blockfree(heap_block *block) static INLINE bool __lwp_heap_blockfree(heap_block *block)
{ {
return !(block->front_flag & HEAP_BLOCK_USED); return !(block->front_flag & HEAP_BLOCK_USED);
} }
static inline u32 __lwp_heap_blocksize(heap_block *block) static INLINE u32 __lwp_heap_blocksize(heap_block *block)
{ {
return (block->front_flag & ~HEAP_BLOCK_USED); return (block->front_flag & ~HEAP_BLOCK_USED);
} }

View File

@ -41,6 +41,7 @@
#include <gccore.h> #include <gccore.h>
#include <ogcsys.h> #include <ogcsys.h>
#include "../gfx/drivers/ppc_asm.h" #include "../gfx/drivers/ppc_asm.h"
#include <retro_inline.h>
#include "vi_encoder.h" #include "vi_encoder.h"
@ -60,20 +61,20 @@ static u32 i2cIdentFirst = 0;
static u32 i2cIdentFlag = 1; static u32 i2cIdentFlag = 1;
static vu32* const _i2cReg = (u32*)0xCD800000; static vu32* const _i2cReg = (u32*)0xCD800000;
static inline void __viOpenI2C(u32 channel) static INLINE void __viOpenI2C(u32 channel)
{ {
u32 val = ((_i2cReg[49]&~0x8000)|0x4000); u32 val = ((_i2cReg[49]&~0x8000)|0x4000);
val |= _SHIFTL(channel,15,1); val |= _SHIFTL(channel,15,1);
_i2cReg[49] = val; _i2cReg[49] = val;
} }
static inline void __viSetSCL(u32 channel) static INLINE void __viSetSCL(u32 channel)
{ {
u32 val = (_i2cReg[48]&~0x4000); u32 val = (_i2cReg[48]&~0x4000);
val |= _SHIFTL(channel,14,1); val |= _SHIFTL(channel,14,1);
_i2cReg[48] = val; _i2cReg[48] = val;
} }
static inline void __viSetSDA(u32 channel) static INLINE void __viSetSDA(u32 channel)
{ {
u32 val = (_i2cReg[48]&~0x8000); u32 val = (_i2cReg[48]&~0x8000);
val |= _SHIFTL(channel,15,1); val |= _SHIFTL(channel,15,1);

View File

@ -15,6 +15,7 @@
#include <xgraphics.h> #include <xgraphics.h>
#include "xdk_resources.h" #include "xdk_resources.h"
#include <retro_inline.h>
#ifdef _XBOX360 #ifdef _XBOX360
struct XPR_HEADER struct XPR_HEADER
@ -64,7 +65,7 @@ void *PackedResource::GetData( const char *strName ) const
return NULL; return NULL;
} }
static inline void* AllocateContiguousMemory( DWORD Size, DWORD Alignment) static INLINE void* AllocateContiguousMemory(DWORD Size, DWORD Alignment)
{ {
#if defined(_XBOX1) #if defined(_XBOX1)
return D3D_AllocContiguousMemory(Size, Alignment); return D3D_AllocContiguousMemory(Size, Alignment);
@ -74,7 +75,7 @@ static inline void* AllocateContiguousMemory( DWORD Size, DWORD Alignment)
#endif #endif
} }
static inline void FreeContiguousMemory( void* pData ) static INLINE void FreeContiguousMemory(void* pData)
{ {
#if defined(_XBOX1) #if defined(_XBOX1)
return D3D_FreeContiguousMemory(pData); return D3D_FreeContiguousMemory(pData);