static inline functions
This commit is contained in:
parent
ffaa3d79ab
commit
392be5c469
12
src/tic.c
12
src/tic.c
|
@ -83,17 +83,17 @@ static void update_amp(blip_buffer_t* blip, tic_sound_register_data* data, s32 n
|
||||||
blip_add_delta( blip, data->time, delta );
|
blip_add_delta( blip, data->time, delta );
|
||||||
}
|
}
|
||||||
|
|
||||||
inline s32 freq2note(double freq)
|
static inline s32 freq2note(double freq)
|
||||||
{
|
{
|
||||||
return (s32)round((double)NOTES * log2(freq / BASE_NOTE_FREQ)) + BASE_NOTE_POS;
|
return (s32)round((double)NOTES * log2(freq / BASE_NOTE_FREQ)) + BASE_NOTE_POS;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double note2freq(s32 note)
|
static inline double note2freq(s32 note)
|
||||||
{
|
{
|
||||||
return pow(2, (note - BASE_NOTE_POS) / (double)NOTES) * BASE_NOTE_FREQ;
|
return pow(2, (note - BASE_NOTE_POS) / (double)NOTES) * BASE_NOTE_FREQ;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline s32 freq2period(double freq)
|
static inline s32 freq2period(double freq)
|
||||||
{
|
{
|
||||||
if(freq == 0.0) return MAX_PERIOD_VALUE;
|
if(freq == 0.0) return MAX_PERIOD_VALUE;
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ inline s32 freq2period(double freq)
|
||||||
return period;
|
return period;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline s32 getAmp(const tic_sound_register* reg, s32 amp)
|
static inline s32 getAmp(const tic_sound_register* reg, s32 amp)
|
||||||
{
|
{
|
||||||
enum {MaxAmp = (u16)-1 / (MAX_VOLUME * TIC_SOUND_CHANNELS)};
|
enum {MaxAmp = (u16)-1 / (MAX_VOLUME * TIC_SOUND_CHANNELS)};
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ static void resetPalette(tic_mem* memory)
|
||||||
memory->ram.vram.vars.mask.data = TIC_GAMEPAD_MASK;
|
memory->ram.vram.vars.mask.data = TIC_GAMEPAD_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setPixel(tic_machine* machine, s32 x, s32 y, u8 color)
|
static inline void setPixel(tic_machine* machine, s32 x, s32 y, u8 color)
|
||||||
{
|
{
|
||||||
if(x < machine->state.clip.l || y < machine->state.clip.t || x >= machine->state.clip.r || y >= machine->state.clip.b) return;
|
if(x < machine->state.clip.l || y < machine->state.clip.t || x >= machine->state.clip.r || y >= machine->state.clip.b) return;
|
||||||
|
|
||||||
|
@ -1579,7 +1579,7 @@ static s32 api_save(const tic_cartridge* cart, u8* buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
// copied from SDL2
|
// copied from SDL2
|
||||||
inline void memset4(void *dst, u32 val, u32 dwords)
|
static inline void memset4(void *dst, u32 val, u32 dwords)
|
||||||
{
|
{
|
||||||
#if defined(__GNUC__) && defined(i386)
|
#if defined(__GNUC__) && defined(i386)
|
||||||
s32 u0, u1, u2;
|
s32 u0, u1, u2;
|
||||||
|
|
Loading…
Reference in New Issue