Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/include/sof/math/numbers.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@
__a > 0 ? 1 : 0; \
})

/* Zephyr added gcd() in 2025/Nov to sys/util.h */
#ifndef gcd
#define USE_SOF_GCD 1
int gcd(int a, int b); /* Calculate greatest common divisor for a and b */
#endif

/* 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.
Expand Down
4 changes: 4 additions & 0 deletions src/math/numbers.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
#include <rtos/symbol.h>
#include <stdint.h>

/* see numbers.h */
#ifdef USE_SOF_GCD

/* This function returns the greatest common divisor of two numbers
* If both parameters are 0, gcd(0, 0) returns 0
* If first parameters is 0 or second parameter is 0, gcd(0, b) returns b
Expand Down Expand Up @@ -74,6 +77,7 @@ int gcd(int a, int b)
return a << k;
}
EXPORT_SYMBOL(gcd);
#endif /* USE_SOF_GCD */

#if CONFIG_NUMBERS_VECTOR_FIND

Expand Down
Loading