From 3d92926a902017e7cf1f5738e99ff62da596ce12 Mon Sep 17 00:00:00 2001 From: Ethan Werner Date: Sun, 9 Aug 2026 15:02:21 +0400 Subject: refactor --- lib/ppo.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'lib/ppo.c') 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; -- cgit v1.3.1