summaryrefslogtreecommitdiffstats
path: root/lib/ppo.c
diff options
context:
space:
mode:
authorEthan Werner <mail@ethanwerner.com>2026-08-09 15:02:21 +0400
committerEthan Werner <mail@ethanwerner.com>2026-08-09 15:02:21 +0400
commit3d92926a902017e7cf1f5738e99ff62da596ce12 (patch)
tree2b55422c26a48759d56fa91f06df24449e9dfa88 /lib/ppo.c
parent07e18043145f3d91c8ea7ec3ad41b3c905585277 (diff)
Diffstat (limited to 'lib/ppo.c')
-rw-r--r--lib/ppo.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/ppo.c b/lib/ppo.c
index b2b3bbf..f367c28 100644
--- a/lib/ppo.c
+++ b/lib/ppo.c
@@ -24,7 +24,7 @@ ts_parameter_t const ts_ppo_p = { .n_inputs = 5, .n_outputs = 2, .n_constants =
uint_t ts_ppo_offset( ts_constant_t const *c )
{
( void )c;
- return ( c ? (uint_t)(((ts_ppo_params_t *)c)->slow_k + ((ts_ppo_params_t *)c)->signal_k - 2) : 0 );
+ return ( c ? (uint_t)(((ts_ppo_params_t const *)c)->slow_k + ((ts_ppo_params_t const *)c)->signal_k - 2) : 0 );
}
int ts_ppo(
@@ -35,12 +35,11 @@ int ts_ppo(
{
TS_PROLOGUE( ts_ppo_p );
if ( !c ) return -1;
- fp_t fast_k = ((ts_ppo_params_t *)c)->fast_k;
- fp_t slow_k = ((ts_ppo_params_t *)c)->slow_k;
- fp_t signal_k = ((ts_ppo_params_t *)c)->signal_k;
+ fp_t fast_k = ((ts_ppo_params_t const *)c)->fast_k;
+ fp_t slow_k = ((ts_ppo_params_t const *)c)->slow_k;
+ fp_t signal_k = ((ts_ppo_params_t const *)c)->signal_k;
if (fast_k == 0 || slow_k == 0 || signal_k == 0) return -1;
- if (n == 0) return -1;
fp_t fast_a = 1.0 / fast_k;
fp_t slow_a = 1.0 / slow_k;