Closed krabiswabbie closed 5 years ago
Couldn't we even get away with [BLOCK_LEN_LONG/2]
then?
I mean, (N >> 2)
divides by 4
and if N
is at most 2 * BLOCK_LEN_LONG
then the array needs to be at most of size BLOCK_LEN_LONG/2
, right?
You're absolutely correct here :) This is exactly what I wanted to say :)
Here is the replacement of the memory allocation method. In this function, the value of the parameter N can be either 2 BLOCK_LEN_SHORT or 2 BLOCK_LEN_LONG. Since the function is called quite often, we can avoid frequent memory allocations using static buffers of the maximum required size. In tests, this simple replacement gives a 2-3% performance gain.