diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-07-14 19:38:31 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2021-07-14 19:38:31 +0100 |
commit | 0b7a4e77fe205edf95e020471d222eb64c05e502 (patch) | |
tree | c9065d621df3e600c59bf57e26c1fc7c1d6aff32 /src | |
parent | 8d6010f86f77c07645319ddca16bd3000f0dcca6 (diff) | |
download | rspamd-0b7a4e77fe205edf95e020471d222eb64c05e502.tar.gz rspamd-0b7a4e77fe205edf95e020471d222eb64c05e502.zip |
[Minor] Use float instead of double
Diffstat (limited to 'src')
-rw-r--r-- | src/libutil/util.c | 10 | ||||
-rw-r--r-- | src/libutil/util.h | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c index 16c8c0f23..8bbc98993 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -2422,12 +2422,12 @@ rspamd_set_counter (struct rspamd_counter_data *cd, gdouble value) return cd->mean; } -double +float rspamd_set_counter_ema (struct rspamd_counter_data *cd, - gdouble value, - gdouble alpha) + float value, + float alpha) { - gdouble diff, incr; + float diff, incr; /* Cumulative moving average using per-process counter data */ if (cd->number == 0) { @@ -2438,7 +2438,7 @@ rspamd_set_counter_ema (struct rspamd_counter_data *cd, diff = value - cd->mean; incr = diff * alpha; cd->mean += incr; - cd->stddev = (1 - alpha) * (cd->stddev + diff * incr); + cd->stddev = (1.0f - alpha) * (cd->stddev + diff * incr); cd->number ++; return cd->mean; diff --git a/src/libutil/util.h b/src/libutil/util.h index d993fcbdf..f3ff94fdd 100644 --- a/src/libutil/util.h +++ b/src/libutil/util.h @@ -468,8 +468,8 @@ GPtrArray *rspamd_glob_path (const gchar *dir, GError **err); struct rspamd_counter_data { - gdouble mean; - gdouble stddev; + float mean; + float stddev; guint64 number; }; @@ -480,9 +480,9 @@ struct rspamd_counter_data { * @param alpha decay coefficient (0..1) * @return new counter value */ -double rspamd_set_counter_ema (struct rspamd_counter_data *cd, - gdouble value, - gdouble alpha); +float rspamd_set_counter_ema (struct rspamd_counter_data *cd, + float value, + float alpha); /** * Sets counter's data using flat moving average |