Fix alignment issue on ARM
Signed-off-by: Maxim Osipov <maxim.osipov@gmail.com>
This commit is contained in:
parent
6ee05f4a2d
commit
37faa8ce59
1 changed files with 4 additions and 2 deletions
|
@ -42,9 +42,11 @@ uint8_t*
|
|||
allocate_buffer(uint16_t size)
|
||||
{
|
||||
uint8_t* buffer = NULL;
|
||||
int rem = 0;
|
||||
/*To get rid of alignment problems, always allocate even size*/
|
||||
if (size % 2) {
|
||||
size++;
|
||||
rem = size % 4;
|
||||
if (rem) {
|
||||
size+=(4-rem);
|
||||
}
|
||||
if (buffer_index + size < buffer_size) {
|
||||
buffer = data_buffer + buffer_index;
|
||||
|
|
Loading…
Reference in a new issue