On 07.05.2018 18:16, Liam Girdwood wrote:
On Mon, 2018-05-07 at 17:12 +0300, Seppo Ingalsuo wrote:
On 07.05.2018 14:19, Liam Girdwood wrote:
On Fri, 2018-05-04 at 18:01 +0300, Seppo Ingalsuo wrote:
+/* 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 one should be static inline.
Please reconsider. Due to code size saving I'd not prefer inline code when low benefit. Division should not be used in speed critical code parts so not inlining this shouldn't be an issue in typical usage.
I didn't yet patch other similar division code parts but e.g. SRC would also use this library function in initialization code.
I'm thinking about the use case when we optimise this with HiFi2/3 (or similar) CEIL arithmetic. inline means we can optimise it to a few instructions.
OK.
Btw, what is the size delta ?
The size impact (.text) was the opposite of what I thought. Inlining it (in math/numbers.h) saved 48 bytes...
Seems I should do this change!
Thanks, Seppo
Liam _______________________________________________ Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware