Re: Compute buffer size at compile-time



Spoon <none> wrote:
Hello,

Consider:

#define BUFFER_SIZE 1234 /* or some other value */
uint8_t buffer[BUFFER_SIZE];
int do_stuff(uint8_t *buf);

where do_stuff() does something with each octet in the buffer.

Assume I've come up with do_stuff_2() similar to do_stuff() but
that works with 16 octets at a time.

I need to compute N at compile time
such that N >= 1234 && N % 16 == 0


#define N (BS / 16) * 16 + 16 ?


--
:wq
^X^Cy^K^X^C^C^C^C
.



Relevant Pages