BQ_BUFFER_SIZE macro correct?
Posted: Tue Jan 12, 2016 3:08 pm
In hal/include/hal_buffers.h there's this definition:
From what I could understand from the documentation of buffers queue, I thought it should compute how many bytes should be allocated for n buffers, each of size size. It does not do this (the parentheses are wrong for this); it looks like it allocates one buffer of size size plus a little bit.
Is this a bug, or do I understand the buffers queue wrong?
Code: Select all
#define BQ_BUFFER_SIZE(n, size) \
((size_t)(size) + ((sizeof (size_t)) * (size_t)(n)))
From what I could understand from the documentation of buffers queue, I thought it should compute how many bytes should be allocated for n buffers, each of size size. It does not do this (the parentheses are wrong for this); it looks like it allocates one buffer of size size plus a little bit.
Is this a bug, or do I understand the buffers queue wrong?