Skip to content

Commit

Permalink
Use inline instead of __inline__.
Browse files Browse the repository at this point in the history
  • Loading branch information
bmc0 committed Sep 7, 2024
1 parent a5238ba commit 33b8de4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion biquad.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void biquad_reset(struct biquad_state *);
void biquad_init_using_type(struct biquad_state *, int, double, double, double, double, double, int);
struct effect * biquad_effect_init(const struct effect_info *, const struct stream_info *, const char *, const char *, int, const char *const *);

static __inline__ sample_t biquad(struct biquad_state *state, sample_t s)
static inline sample_t biquad(struct biquad_state *state, sample_t s)
{
#if BIQUAD_USE_TDF_2
sample_t r = (state->c0 * s) + state->m0;
Expand Down
8 changes: 4 additions & 4 deletions cap5.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void ap3_reset(struct ap3_state *);
void cap5_reset(struct cap5_state *);
void cap5_init(struct cap5_state *, double, double);

static __inline__ sample_t ap1_run(struct ap1_state *state, sample_t s)
static inline sample_t ap1_run(struct ap1_state *state, sample_t s)
{
sample_t r = state->c0 * (s - state->o0)
+ state->i0;
Expand All @@ -58,7 +58,7 @@ static __inline__ sample_t ap1_run(struct ap1_state *state, sample_t s)
return r;
}

static __inline__ sample_t ap2_run(struct ap2_state *state, sample_t s)
static inline sample_t ap2_run(struct ap2_state *state, sample_t s)
{
sample_t r = state->c1 * (s - state->o1)
+ state->c0 * (state->i0 - state->o0)
Expand All @@ -73,12 +73,12 @@ static __inline__ sample_t ap2_run(struct ap2_state *state, sample_t s)
return r;
}

static __inline__ sample_t ap3_run(struct ap3_state *state, sample_t s)
static inline sample_t ap3_run(struct ap3_state *state, sample_t s)
{
return ap1_run(&state->ap1, ap2_run(&state->ap2, s));
}

static __inline__ void cap5_run(struct cap5_state *state, sample_t s, sample_t *lp, sample_t *hp)
static inline void cap5_run(struct cap5_state *state, sample_t s, sample_t *lp, sample_t *hp)
{
sample_t a1 = ap2_run(&state->a1, s);
sample_t a2 = ap3_run(&state->a2, s);
Expand Down
14 changes: 7 additions & 7 deletions ewma.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,49 +28,49 @@ struct ewma_state {
#define EWMA_RISE_TIME(x) ((x)/1000.0/2.1972) /* 10%-90% rise time in ms */

/* note: tc is the time constant in seconds */
static __inline__ void ewma_init(struct ewma_state *state, double fs, double tc)
static inline void ewma_init(struct ewma_state *state, double fs, double tc)
{
const double a = 1.0-exp(-1.0/(fs*tc));
state->c0 = a;
state->c1 = 1.0-a;
state->m0 = 0.0;
}

static __inline__ double ewma_run(struct ewma_state *state, double s)
static inline double ewma_run(struct ewma_state *state, double s)
{
const double r = state->c0*s + state->c1*state->m0;
state->m0 = r;
return r;
}

/* note: sf > 1.0 means a faster rise time */
static __inline__ double ewma_run_scale(struct ewma_state *state, double s, double sf)
static inline double ewma_run_scale(struct ewma_state *state, double s, double sf)
{
const double c = (state->c0*sf > 0.39) ? 0.39 : state->c0*sf;
const double r = c*s + (1.0-c)*state->m0;
state->m0 = r;
return r;
}

static __inline__ double ewma_run_scale_asym(struct ewma_state *state, double s, double rise_sf, double fall_sf)
static inline double ewma_run_scale_asym(struct ewma_state *state, double s, double rise_sf, double fall_sf)
{
return (s >= state->m0) ? ewma_run_scale(state, s, rise_sf) : ewma_run_scale(state, s, fall_sf);
}

static __inline__ double ewma_run_set_max(struct ewma_state *state, double s)
static inline double ewma_run_set_max(struct ewma_state *state, double s)
{
if (s >= state->m0) s = ewma_run(state, s);
else state->m0 = s;
return s;
}

static __inline__ double ewma_set(struct ewma_state *state, double s)
static inline double ewma_set(struct ewma_state *state, double s)
{
state->m0 = s;
return s;
}

static __inline__ double ewma_get_last(struct ewma_state *state)
static inline double ewma_get_last(struct ewma_state *state)
{
return state->m0;
}
Expand Down
8 changes: 4 additions & 4 deletions matrix4_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ int parse_effect_opts(const char *const *, const struct stream_info *, struct ma
struct effect * matrix4_delay_effect_init(const struct effect_info *, const struct stream_info *, ssize_t);

#ifndef DSP_MATRIX4_COMMON_H_NO_STATIC_FUNCTIONS
static __inline__ double err_scale(double a, double b, double err, double max_err_gain)
static inline double err_scale(double a, double b, double err, double max_err_gain)
{
if (!isnormal(a) && !isnormal(b))
return 1.0;
Expand All @@ -127,7 +127,7 @@ static __inline__ double err_scale(double a, double b, double err, double max_er
return 1.0 + err*n/d;
}

static __inline__ double drift_scale(const struct axes *ax0, const struct axes *ax1, const struct envs *env, double sens_err, double sens_level)
static inline double drift_scale(const struct axes *ax0, const struct axes *ax1, const struct envs *env, double sens_err, double sens_level)
{
const double lr_err = fabs(ax1->lr - ax0->lr) / M_PI_2;
const double cs_err = fabs(ax1->cs - ax0->cs) / M_PI_2;
Expand All @@ -137,7 +137,7 @@ static __inline__ double drift_scale(const struct axes *ax0, const struct axes *
}

#if DOWNSAMPLE_FACTOR > 1
static __inline__ double oversample(const double y[2], double x)
static inline double oversample(const double y[2], double x)
{
return y[0] + (x/DOWNSAMPLE_FACTOR)*(y[1]-y[0]);
}
Expand Down Expand Up @@ -187,7 +187,7 @@ static void event_config_init(struct event_config *evc, const struct stream_info
evc->ord_factor_c = exp(-1.0/(DOWNSAMPLED_FS(istream->fs)*ORD_FACTOR_DECAY));
}

static __inline__ double fade_mult(ssize_t pos, ssize_t n, int is_out)
static inline double fade_mult(ssize_t pos, ssize_t n, int is_out)
{
double fade = (double) (n-pos) / n;
if (is_out) fade = 1.0 - fade;
Expand Down
8 changes: 4 additions & 4 deletions util.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ char * isolate(char *, char);
ssize_t next_fast_fftw_len(ssize_t);
#endif

static __inline__ long unsigned int pm_rand(void)
static inline long unsigned int pm_rand(void)
{
static long unsigned int s = 1;
long unsigned int h, l;
Expand All @@ -78,7 +78,7 @@ static __inline__ long unsigned int pm_rand(void)
return (s = l);
}

static __inline__ sample_t tpdf_dither_sample(sample_t s, int prec)
static inline sample_t tpdf_dither_sample(sample_t s, int prec)
{
if (prec < 1 || prec > 32)
return s;
Expand All @@ -89,13 +89,13 @@ static __inline__ sample_t tpdf_dither_sample(sample_t s, int prec)
return s + n1 - n2;
}

static __inline__ ssize_t ratio_mult_ceil(ssize_t v, int n, int d)
static inline ssize_t ratio_mult_ceil(ssize_t v, int n, int d)
{
long long int r = (long long int) v * n;
return (ssize_t) ((r % d != 0) ? r / d + 1 : r / d);
}

static __inline__ int find_gcd(int a, int b)
static inline int find_gcd(int a, int b)
{
int c;
while (b != 0) {
Expand Down

0 comments on commit 33b8de4

Please sign in to comment.