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)
|
allocate_buffer(uint16_t size)
|
||||||
{
|
{
|
||||||
uint8_t* buffer = NULL;
|
uint8_t* buffer = NULL;
|
||||||
|
int rem = 0;
|
||||||
/*To get rid of alignment problems, always allocate even size*/
|
/*To get rid of alignment problems, always allocate even size*/
|
||||||
if (size % 2) {
|
rem = size % 4;
|
||||||
size++;
|
if (rem) {
|
||||||
|
size+=(4-rem);
|
||||||
}
|
}
|
||||||
if (buffer_index + size < buffer_size) {
|
if (buffer_index + size < buffer_size) {
|
||||||
buffer = data_buffer + buffer_index;
|
buffer = data_buffer + buffer_index;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue