mirror of https://github.com/thesofproject/sof.git
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:
parent
1b0fc77f83
commit
d98e6ec4da
|
@ -40,8 +40,19 @@
|
||||||
|
|
||||||
int gcd(int a, int b); /* Calculate greatest common divisor for a and b */
|
int gcd(int a, int b); /* Calculate greatest common divisor for a and b */
|
||||||
|
|
||||||
/* Divide function that returns ceil() of quotient */
|
/* This is a divide function that returns ceil of the quotient.
|
||||||
int ceil_divide(int a, int b);
|
* 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 */
|
/* 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,
|
int find_equal_int16(int16_t idx[], int16_t vec[], int n, int vec_length,
|
||||||
|
|
|
@ -49,20 +49,6 @@ int gcd(int a, int b)
|
||||||
return a;
|
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
|
/* This function searches from vec[] (of length vec_length) integer values
|
||||||
* of n. The indexes to equal values is returned in idx[]. The function
|
* 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
|
* returns the number of found matches. The max_results should be set to
|
||||||
|
|
Loading…
Reference in New Issue