DMIC: Move ceil_divide from numbers.c to numbers.h as static inline

The DMIC driver needs this function. This inline version is a
bit faster and the change does not increase code size.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2018-05-11 17:03:08 +03:00 committed by Liam Girdwood
parent 1b0fc77f83
commit d98e6ec4da
2 changed files with 13 additions and 16 deletions

View File

@ -40,8 +40,19 @@
int gcd(int a, int b); /* Calculate greatest common divisor for a and b */
/* Divide function that returns ceil() of quotient */
int ceil_divide(int a, int b);
/* This is a divide function that returns ceil of the quotient.
* E.g. ceil_divide(9, 3) returns 3, ceil_divide(10, 3) returns 4.
*/
static inline int ceil_divide(int a, int b)
{
int c;
c = a / b;
if (c * b < a)
c++;
return c;
}
/* Find indices of equal values in a vector of integer values */
int find_equal_int16(int16_t idx[], int16_t vec[], int n, int vec_length,

View File

@ -49,20 +49,6 @@ int gcd(int a, int b)
return a;
}
/* This is a divide function that returns ceil of the quotient.
* E.g. ceil_divide(9, 3) returns 3, ceil_divide(10, 3) returns 4.
*/
int ceil_divide(int a, int b)
{
int c;
c = a / b;
if (c * b < a)
c++;
return c;
}
/* This function searches from vec[] (of length vec_length) integer values
* of n. The indexes to equal values is returned in idx[]. The function
* returns the number of found matches. The max_results should be set to