Page 1 of 1

Easy Hard Clip (Max Value) of Accumulator

Posted: Wed Sep 06, 2017 10:28 am
by thegrinch
Hi, I am looking for a way to easily clip the accumulator at a maximum value (e.g. if(accum > .5){accum = .5}; kind of thing). The MAXX instruction does this nicely for clipping the accumulator to a minimum value, but there is not an accompanying MINX instruction (would have been nice!).

I'd imagine people have found the fastest way to do this by this point, so I wanted to ask for y'all's solutions to the problem. Trying to keep the instruction count required to accomplish this as low as possible.

Thanks!

Posted: Wed Sep 06, 2017 11:22 am
by frank
If 0.5 is the actual desired clip value and the value is in ACC then try something like:

sof -2.0,0
sof -0.5,0

Posted: Sun Sep 10, 2017 11:09 am
by thegrinch
Okay. I assume that is using the fact that the maximum range of the accumulator is +.9999389 to -1.0?