File: quantize.c

package info (click to toggle)
jack-tools 20131226-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 712 kB
  • sloc: ansic: 6,183; makefile: 105; lisp: 54
file content (10 lines) | stat: -rw-r--r-- 197 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
#include <math.h>
#include "float.h"
#include "quantize.h"

/* Return the multiple of `quanta' nearest to `value'. */
f32
quantize(f32 quanta,f32 value)
{
  return quanta * roundf(value/quanta);
}