Signed-off-by: huhui <huhui@sharkgulf.com>
@@ -83,6 +83,23 @@ static __INLINE void step_towards(float *value, float goal, float step) {
}
+static __INLINE void step_towards_s16(s16 *value, s16 goal, s16 step) {
+ if (*value < goal) {
+ if ((*value + step) < goal) {
+ *value += step;
+ } else {
+ *value = goal;
+ }
+ } else if (*value > goal) {
+ if ((*value - step) > goal) {
+ *value -= step;
+}
+
/**
* Fast atan2
*